我试图在我的django项目中包含login with google服务,为此我使用social auth。在
在输入我的url后localhost:8000/secrets它将重定向到我的google帐户,并在我单击allow之后请求访问我的公共数据的权限,它将重定向到localhost:8000/login-errorurl并显示为
Authentication failed: User not allowed。在
emails = setting('GOOGLE_WHITE_LISTED_EMAILS', [])
domains = setting('GOOGLE_WHITE_LISTED_DOMAINS', [])
if not emails and not domains:
return True
if email in set(emails):
return True # you're good
if email.split('@', 1)[1] in set(domains):
return True
raise AuthFailed(backend, 'User not allowed')
我终于解决了这个问题!!在
看看这个代码:
删除设置中的},
问题会解决的(对我而言)
GOOGLE_WHITE_LISTED_EMAILS
和{~
相关问题 更多 >
编程相关推荐