- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在我的 Django 项目中使用 Django-Allauth。我添加了一些社交服务提供商(Facebook、谷歌),效果非常好!
但是我在尝试使用 OpenID 提供商时遇到了问题。到目前为止,我一直在使用 Yahoo 和 AOL 对其进行测试,但都以相同的错误结束:openid.consumer.consumer.ProtocolError: Parameter next not in return_to URL
。
我项目的setting.py文件的一些相关信息:
INSTALLED_APPS = [
# Django apps
'django.contrib.auth',
'django.contrib.sites',
# Allauth apps
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.openid',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
# Project apps
'frontoffice.apps.FrontofficeConfig',
'middleoffice.apps.MiddleofficeConfig',
]
SITE_ID = 1
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
)
# Email sending
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = 'secret'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
# Auth and allauth settings
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_USERNAME_MIN_LENGTH = 3
# Redirections
ACCOUNT_LOGOUT_REDIRECT_URL = '/front-office'
LOGIN_REDIRECT_URL = '/front-office'
# Email verification
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
SOCIALACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 3 # in days
ACCOUNT_EMAIL_CONFIRMATION_COOLDOWN = 30 # in seconds
# Account signup
ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE = True
ACCOUNT_SIGNUP_FORM_CLASS = 'frontoffice.forms.UserAccountForm'
# Social Accounts
SOCIALACCOUNT_AUTO_SIGNUP = False
SOCIALACCOUNT_EMAIL_REQUIRED = True
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_PROVIDERS = {
'openid': {
'SERVERS': [
dict(id='yahoo',
name='Yahoo OpenID',
openid_url='http://me.yahoo.com'),
]
},
'facebook': {
'SCOPE': ['email', ],
'METHOD': 'js_sdk',
'INIT_PARAMS': {'cookie': True},
'FIELDS': ['id', 'email', 'name', 'first_name', 'last_name', 'verified', 'locale', 'timezone', 'link', 'gender', 'updated_time',],
'VERIFIED_EMAIL': False,
},
'google': {
'SCOPE': [
'profile',
'email',
],
'AUTH_PARAMS': {
'access_type': 'online',
}
}
}
我知道有些设置不会覆盖默认值或者是多余的,它只是帮助我记住我应该期望的行为。
正如我所说,我尝试了 Yahoo OpenID ( http://me.yahoo.com ),既来自预定义的提供商和 OpenID URL,也尝试了 AOL,来自 URL ( http://openid.aol.com/myUserName)。两者都返回上述错误,这是一个堆栈跟踪示例:
INFO:django.server:"GET /accounts/openid/login/?openid=http%3A%2F%2Fme.yahoo.com&process=login HTTP/1.1" 302 0
ERROR:root:Verifying return_to arguments: Parameter next not in return_to URL
Traceback (most recent call last):
File "d:\Profiles\user\Envs\Django\lib\site-packages\openid\consumer\consumer.py", line 673, in _checkReturnTo
self._verifyReturnToArgs(message.toPostArgs())
File "d:\Profiles\user\Envs\Django\lib\site-packages\openid\consumer\consumer.py", line 886, in _verifyReturnToArgs
(pair[0], ))
openid.consumer.consumer.ProtocolError: Parameter next not in return_to URL
INFO:django.server:
"GET /accounts/openid/callback/?janrain_nonce=2017-11-21T15:56:32_nonce_zu
&next=
&openid.ns=http://specs.openid.net/auth/2.0
&openid.mode=id_res
&openid.return_to=http://localhost:8000/accounts/openid/callback/?janrain_nonce=2017-11-21T15:56:32_nonce_zu
&next=
&openid.claimed_id=https://me.yahoo.com/a/C7dd_secret_bVtec-#784b5
&openid.identity=https://me.yahoo.com/a/C7dd_secret_bVtec-
&openid.assoc_handle=1P.qFXi_secret_7MP8.Cv06_secret_wEeA--
&openid.realm=http://localhost:8000/
&openid.ns.ax=http://openid.net/srv/ax/1.0
&openid.ax.mode=fetch_response
&openid.ax.value.email=jane.doe@yahoo.fr
&openid.ax.value.fullname=Jane Doe
&openid.response_nonce=2017-11-21T15:56:33Zd_nonce_eA--
&openid.signed=assoc_handle,claimed_id,identity,mode,ns,op_endpoint,response_nonce,return_to,signed,ax.value.email,ax.type.email,ax.value.fullname,ax.type.fullname,ns.ax,ax.mode,pape.auth_level.nist
&openid.op_endpoint=https://open.login.yahooapis.com/openid/op/auth
&openid.ax.type.email=http://axschema.org/contact/email
&openid.ax.type.fullname=http://axschema.org/namePerson
&openid.pape.auth_level.nist=0
&openid.sig=n/JOWn_secret_3630=
HTTP/1.1"
200 647
为了便于阅读,我在参数之间放置了换行符。
如您所见,错误消息非常明显:参数 &next= 为空。
有没有人碰巧知道哪里出了问题?它是与提供商相关、与库相关、与配置/实现相关吗?
提前致谢!
最佳答案
事实证明,allauth 存在一个错误,在 openid 登录 URL 中不提供 next
将导致此错误。我发出a PR to address this issue ,所以希望它在某个时候被合并。
同时,您有两个选择:
-e git://github.com/pydolan/django-allauth.git@fix-yahoo-openid#egg=django-allauth
添加到 requirements.txt); next
提供一个值。例如:/accounts/openid/login/?process=login&openid=https%3A%2F%2Fme.yahoo.com&next=%2F
将让您使用 OpenID 登录 Yahoo。 关于python - 我无法让 OpenID 工作(openid.consumer.consumer.ProtocolError : Parameter next not in return_to URL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47418261/
目前我正在尝试创建一个 Web 部署包。所以我在我的项目的根目录中添加了一个 parameters.xml 并指定了一些自定义参数。 我发现我的很多参数都部分相同。所以我想做某种参数引用。寻找这个,我
如何设置我的 Symfony 2 项目以使用 parameters.yml 而不是 parameters.ini? 在 Controller 中,我可以像这样从 parameters.ini 中获取变
有什么建议说明为什么此 AWS CloudFormation 不断回滚吗? { "Description" : "Single Instance", "Resources" : {
PARAMETERS: p_1 TYPE i, p_2 TYPE i. 因此在初始屏幕中,我看到了 2 个文本框,每个参数一个。 如果我填写其中一个,但不按回车键,然后我在第二个上调用 F4 帮助,我
我需要存储 Parameter由 Build() 返回作为 Parameter (因为我将参数存储在一个数组中,另一种方法就是为每个参数数量复制粘贴相同的类太多,因为 c# 没有可变参数泛型)。 问题
我正在为我的 CS 类(class)做作业,它使用了 const,我对何时使用它们感到有点困惑。 这3个函数有什么区别? int const function(parameters) int fu
在 xgboost 的文档中,我读到: base_score [default=0.5] : the initial prediction score of all instances, global
我正在创建一个新的 REST 服务。 向 REST 服务传递参数的标准是什么。在 Java 的不同 REST 实现中,您可以将参数配置为路径的一部分或请求参数。例如, 路径参数 http://www.
在我的程序中,我需要验证传递给程序的参数是一个整数,所以我创建了这个小函数来处理用户键入“1st”而不是“1”的情况。 问题是它根本不起作用。我尝试调试,我只能告诉你参数是 12,long 是 2。(
谁能告诉我如何使用存储在 &rest 指定值中的参数。 我已经阅读了很多,似乎作者只知道如何列出所有参数。 (defun test (a &rest b) b) 这很高兴看到,但并不是很有用。 到目前
我使用 git 有一段时间了,但大多数时候我更喜欢与 Intelij IDEA 的集成。现在,为了扩展我对系统的知识和理解,我决定更多地使用命令行。我观察到的是有两种类型的参数: --paramete
我正在用 RAML 编写一些 REST 文档,但我被卡住了。 我的问题: - 我有一个用于搜索的 GET 请求,它可以采用参数“id”或( 独占或 )“引用”。拥有 只有其中之一 是必须的。 我知道怎
我定义了一个这样的 Action : /secure/listaAnnunci.action /login.jsp 我可以从 Action 内部访问参数吗?谢谢 最佳答案 您需要实现 S
我有一个 TeamCity 8.0.3 项目,其中包含多个配置,其中有一个通用参数(定义为项目参数):targetServerIP .这些配置之一是“一键部署”,它通过使用快照依赖项启动其他配置。我已
try{ Class.forName("com.mysql.jdbc.Driver"); mycon = DriverManager.getConnec
我在实际的 javascript 项目中遇到了一个非常奇怪的情况。我创建了一个自定义事件并将数组放入该事件 $.publish("merilon/TablesLoaded", getTables())
在使用参数数组进行插入/更新期间,可以忽略一个/一些特定行的一个/一些参数。 我提供了一个简单的例子。想象一下,我们有一个包含 3 列的表:X、Y 和 Z。我们想在 block 中执行更新(如果缺少某
如何编写接受未定义参数的函数?我想它可以像那样工作: void foo(void undefined_param) { if(typeof(undefined_param) == int) {
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章PDO版本问题 Invalid parameter number: no
Jenkins 管道作业如下所示: 部分 Jenkinsfile(我们使用脚本化管道)是: properties([parameters([string(defaultValue: "", descr
我是一名优秀的程序员,十分优秀!