OpenID和OAuth不工作

OpenID和OAuth不工作,oauth,openid,Oauth,Openid,以下来自googlecodesamples的链接正在运行 注意:因为我只能有2个链接,所以我不能指向我的来源 问题stackover google hybrid openidoauth登录未提示oauth访问 和开发者\u谷歌\u com/accounts/docs/OpenID https://accounts.google.com/o/openid2/auth?openid.ns=http://specs.openid.net/auth/2.0 &openid.claimed_id=

以下来自googlecodesamples的链接正在运行

注意:因为我只能有2个链接,所以我不能指向我的来源

问题stackover google hybrid openidoauth登录未提示oauth访问

和开发者\u谷歌\u com/accounts/docs/OpenID

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.required=email,first,last
&openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0
&openid.oauth.consumer=googlecodesamples.com
&openid.oauth.scope=http://www.google.com/m8/feeds/
在上面

它将引导您登录/确认并返回一个空白页面,但回复url如下所示:

http://googlecodesamples.com/hybrid/index.php?
openid.ns=http://specs.openid.net/auth/2.0
openid.mode=id_res
openid.op_endpoint=https://www.google.com/accounts/o8/ud
openid.response_nonce=2012-08-02T22:51:28ZNuhXnuA5P14fcg
openid.return_to=http://googlecodesamples.com/hybrid/index.php
openid.assoc_handle=AMlYA9XA_khrLenZI2mnUwkI1PWV-7ERMRXskVzs_nlFhq87rO0iowVL
openid.signed=op_endpoint,claimed_id,identity,return_to,response_nonce,
  assoc_handle,ns.ext1,ns.ext2,ext1.mode,ext1.type.first,ext1.value.first,
  ext1.type.email,ext1.value.email,ext1.type.last,ext1.value.last,ext2.scope,
  ext2.request_token
openid.sig=JFoYU7PM4GoKBODmLyMtip5q7x4=
openid.identity=https://www.google.com/accounts/o8/id?id=AItOawlvAimmJ5_y6-gMro7Xyl75LXMC7jYCkiA
openid.claimed_id=https://www.google.com/accounts/o8/id?id=AItOawlvAimmJ5_y6-gMro7Xyl75LXMC7jYCkiA
openid.ns.ext1=http://openid.net/srv/ax/1.0
openid.ext1.mode=fetch_response
openid.ext1.type.first=http://axschema.org/namePerson/first
openid.ext1.value.first=nico
openid.ext1.type.email=http://axschema.org/contact/email
openid.ext1.value.email=nico.gtest@gmail.com
openid.ext1.type.last=http://axschema.org/namePerson/last
openid.ext1.value.last=gtest
openid.ns.ext2=http://specs.openid.net/extensions/oauth/1.0
openid.ext2.scope=http://www.google.com/m8/feeds/
openid.ext2.request_token=4/vAQqXlNILhAC0KCIBS2xlhtpo0IT.4lllxzFP7ncSgrKXntQAax2gXBbTcQI
其中重要的部分是openid.ext2.request\u令牌开关,该开关出现在应答中

但是,如果我更改了指向我的信息的链接,则回复中没有任何oauth字段

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://dev.oncrm.co.za:9004/gauthapp/myserv?test_v=verify_dbug
&openid.realm=http://dev.oncrm.co.za:9004
&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.required=email,first,last
&openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0
&openid.oauth.consumer=dev.oncrm.co.za:9004
&openid.oauth.scope=http://www.google.com/m8/feeds/
在上面

我已经在谷歌控制台注册了我的域名

创建了一个客户端ID和客户端密码,witch没有在任何示例的url中使用

打开所有API服务

openid.realm==openid.oauth.consumer与示例相同

openID部分工作正常,但无法让google返回openID.ext2.request\u令牌 ,因此我可以继续请求访问令牌

我还使用了OpenID4JavaAPI(带有oauth扩展,第110期),但在oauth上没有成功

问题

a) 为什么我的链接不起作用,我还必须做什么

b) 如果不使用客户机ID和客户机机密,那么客户机ID和客户机机密的概念是什么

c) 参数:openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0 openID+OAuth是否正在oauth1.0或oauth2.0上工作

如果您有任何帮助,我们将不胜感激


感谢nico

我在文档中没有看到Google声明OpenId+OAuth与OAuth 2.0一起工作的地方。他们的所有文档都指向1.0OAuth,我还没有看到谷歌的任何声明说它可以与2.0配合使用。

正如Mark所指出的,你还不能用OAuth 2.0实现OpenID+OAuth,只有1.0。不过,我确实认为1.0适用于您所请求的范围,如果它意味着消除用户的第二个授权步骤,那么它可能比2.0更值得使用

假设1.0适合你,我认为你的链接的问题是你需要使用谷歌的“管理你的域名”工具注册你的域名(https://accounts.google.com/ManageDomains),而不是API控制台。据我所知,API控制台专门用于OAuth 2.0

假设我的直觉是正确的,答案是(a)和(c),尽管顺序相反。至于(b),我认为客户端ID只在OAuth2.0中使用。客户端密码存在于1.0和2.0中,用于对访问令牌的请求进行签名,这是在收到请求令牌后执行的。因此,这个过程是:(1)获取请求令牌(可以作为OpenID身份验证的一部分来完成),(2)将请求令牌交换为访问令牌,(3)使用访问令牌调用API


希望这能回答您的问题,但如果没有,请告诉我(或者如果我在任何地方离开基地)。在过去的几天里,我一直在努力解决这个问题,我很想听听您的进展。

我通过以下API和配置成功地实现了它

a) 使用(https://accounts.google.com/ManageDomains)要设置域并使用(https://developers.google.com/gdata/docs/auth/oauth)创建和上载X.509证书

b) 带oauth扩展的API openid4java(第110期)

c) 资源与样本

OAuthExample.java from gdata-samples.java-1.47.1
ConsumerServlet.java from openid4java
Sample.java from issue 110
d) 使用OAuthRsaSha1Signer进行签名(从上传X.509证书),则OAuthHmacSha1Signer不需要oauthReqTokenSecret或accessTokenSecret开关

e) 还需要使用ContactsService进行签名

对于OAuth1的弃用仍然存在担忧,如果等待openid与OAuth2一起使用不是更好的话

有人知道什么时候会这样吗???