Python 谷歌混合OpenID+;OAuth登录不提示OAuth访问

Python 谷歌混合OpenID+;OAuth登录不提示OAuth访问,python,oauth,openid,Python,Oauth,Openid,我试图在Google AppEngine站点上实现Google的混合OpenID+OAuth登录。出于某种原因,我的登录链接只会提示用户通过他们的Google帐户(OpenID)进行登录访问。它不要求访问Contacts/Docs/etc(OAuth) 谷歌网站上的示例使用此URL登录: https://accounts.google.com/o/openid2/auth? openid.ns=http://specs.openid.net/auth/2.0& openid.claime

我试图在Google AppEngine站点上实现Google的混合OpenID+OAuth登录。出于某种原因,我的登录链接只会提示用户通过他们的Google帐户(OpenID)进行登录访问。它不要求访问Contacts/Docs/etc(OAuth)

谷歌网站上的示例使用此URL登录:

https://accounts.google.com/o/openid2/auth?
openid.ns=http://specs.openid.net/auth/2.0&
openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&
openid.identity=http://specs.openid.net/auth/2.0/identifier_select&
openid.return_to=http://googlecodesamples.com/hybrid/index.php&
openid.realm=http://googlecodesamples.com&
openid.mode=checkid_setup&
openid.ns.ui=http://specs.openid.net/extensions/ui/1.0&
openid.ns.ext1=http://openid.net/srv/ax/1.0&
openid.ext1.mode=fetch_request&
openid.ext1.type.email=http://axschema.org/contact/email&
openid.ext1.type.first=http://axschema.org/namePerson/first&
openid.ext1.type.last=http://axschema.org/namePerson/last&
openid.ext1.type.country=http://axschema.org/contact/country/home&
openid.ext1.type.lang=http://axschema.org/pref/language&
openid.ext1.required=email,first,last,country,lang&
openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0&
openid.oauth.consumer=googlecodesamples.com&
openid.oauth.scope=http://docs.google.com/feeds/+http://spreadsheets.google.com/feeds/+http://www-opensocial.googleusercontent.com/api/people/

如果单击该链接,请注意它如何提示访问电子邮件/国家/语言以及文档和联系人

如果我用我的值替换这3个参数:

openid.return_to=http://2.myapp.appspot.com&
openid.realm=http://*.myapp.appspot.com&
openid.oauth.consumer=myapp.appspot.com&
它仍然显示登录页面,但只要求提供电子邮件/国家/语言…没有提及文档/联系人


应用程序域已通过谷歌注册和验证-我是否遗漏了什么?如果我单独实现OAuth,并为文档和联系人生成一个身份验证URL,它工作得很好……但如果可能的话,我真的很想用这种混合方法一步完成所有工作。

为了使混合请求被视为有效,oauth2使用者和OpenID2领域必须“匹配”。在本例中,领域将匹配消费者的某些值,例如2.myapp.appspot.com,但不匹配myapp.appspot.com


一个可能的解决方案是将'2.myapp.appspot.com'注册为您的OAuth2消费者。

虽然这是在App Engine上,但实际上与App Engine无关。谢谢!我在询问子域可能是个问题后不久就想到了这一点。将子域注册为OAuth2使用者后,它就可以完美地工作了。