错误:通过django创建谷歌登录时出现redirect_uri_mismatch错误

时间:2018-04-16 15:51:51

标签: python django

我一直在通过示例书来浏览django。我已经对谷歌登录进行了必要的更改。

图片下方的

显示https://console.developers.google.com/apis设置。 Below is the authorized redirect URI settings

settings.py

中键的更改
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qdf As DAO.QueryDef

Dim sqlString As String

Set db = CurrentDb()
Set qdf = db.QueryDefs("mySavedQuery")

qdf!VariableParam = "LA-85995561"

Set rs = qdf.OpenRecordset()  
' rs CAN BE USED IN FORMS/REPORTS RECORDSOURCES:
' Set Me.Form.Recordset = rst
' Set Me.Report.Recordset = rst

我已启用了本书中提到的google + API,下面是我的HTML链接。

AUTHENTICATION_BACKENDS = (
                    'django.contrib.auth.backends.ModelBackend',
                    'account.authentication.EmailAuthBackend',
                    'social.backends.facebook.Facebook2OAuth2',#for face book authentication
                    'social.backends.google.GoogleOAuth2',
                    )





#Creating a facebook authentication for django auth framework
SOCIAL_AUTH_FACEBOOK_KEY = '356920068048038' # Facebook App ID
SOCIAL_AUTH_FACEBOOK_SECRET = 'f57792e060753abb7f15ed183512ee4a' # Facebook App Secret


#Asking additional permissions for facebook users
SOCIAL_AUTH_FACEBOOK_SCOPE = ['email']


SOCIAL_AUTH_REDIRECT_IS_HTTPS = True



#google authentication
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY ='419087081878-rt976l4dovnujv6lhjnfgtkc8sejpjlf.apps.googleusercontent.com' # Google Consumer Key
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'ItMLE4-nSID-UG73xm7tiL2f' # Google Consumer Secret

当我点击google登录时,我收到错误**错误:redirect_uri_mismatch。**下面是截图。

enter image description here

我已经通过各种在线资源来解决此问题,但截至目前尚未成功,请让我知道如何解决此问题。

1 个答案:

答案 0 :(得分:0)

Google在错误消息中显示的重定向uri与Google设置中的授权uri不同。将localhost uri添加到Google设置。