Django allauth谷歌OAuth redirect_uri_mismatch错误 [英] Django allauth google OAuth redirect_uri_mismatch error

查看:73
本文介绍了Django allauth谷歌OAuth redirect_uri_mismatch错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的Django应用程序使用Google OAuth(通过allauth软件包)

I am using Google OAuth for my Django App (via allauth package)

我已遵循所有标准配置步骤.在Google Developer Console中,这就是我所拥有的:

I have followed all standard configuration steps. In Google Developer console here's what i have:

授权的JavaScript来源

https://example.com  

授权的重定向URI

https://example.com/accounts/google/login/callback/ - login fails
http://example.com/accounts/google/login/callback/ - login succeeds

我观察到的是,如果我在授权重定向URI中有一个 https 重定向URL,它将不允许登录,并且会失败,并出现 redirect_uri_mismatch 错误.如果我有一个 http 重定向URL,则登录成功.

What i observe that if i have a https redirect URL in Authorized redirect URIs, it does not allow login and it fails with redirect_uri_mismatch Error. If i have a http redirect URL then the login succeeds.

要启用启用https的重定向URL,我该怎么办?

What do i need to do to have a https enabled redirect URL ?

推荐答案

在生产设置中添加以下内容.py为我解决了该问题:

Adding the following in production settings.py fixed the problem for me:

ACCOUNT_DEFAULT_HTTP_PROTOCOL ='https'

ACCOUNT_DEFAULT_HTTP_PROTOCOL='https'

这篇关于Django allauth谷歌OAuth redirect_uri_mismatch错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆