简体   繁体   English

为什么我的Google端点总是相同?

[英]Why my Google endpoint is always the same?

always: https://www.google.com/accounts/o8/ud 始终: https//www.google.com/accounts/o8/ud

i got wordpress openid ok. 我有WordPress的openid好。 so i think is is just discovery phase got some probelms.. 所以我认为这只是发现阶段中的一些问题。

<?php $ch = curl_init();



$url = 'https://www.google.com/accounts/o8/id';
 $url = $url.'?';
 $url = $url.'openid.mode=checkid_setup';
 $url = $url.'&openid.ns=http://specs.openid.net/auth/2.0';
 $url = $url.'&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select';
 $url = $url.'&openid.identity=http://specs.openid.net/auth/2.0/identifier_select';
 $url = $url.'&openid.return_to='.site_url().'/user/openid/login_callback';
 $url = $url.'&openid.realm=http://www.example.com/';


 // set url
 curl_setopt($ch, CURLOPT_URL, $url);

 //return the transfer as a string
 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_HTTPHEADER,array("Accept: */*"));
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

 // $output contains the output string
 $xdr = curl_exec($ch);
 if (!$xdr) {
  die(curl_error($ch));
 }
 // close curl resource to free up system resources
 curl_close($ch);
 $xml = new SimpleXMLElement($xdr);

 $url = $xml->XRD->Service->URI;
 $request = $connection->begin($url);

$request always null... $ request始终为null ...

Take a look at http://blog.stackoverflow.com/2009/11/google-offers-named-openids/ where Jeff explains this behavior and what the user can do about it: 看看http://blog.stackoverflow.com/2009/11/google-offers-named-openids/ ,其中Jeff解释了此行为以及用户可以采取的措施:

Well, the good news is, now you can! 好吧,好消息是,现在您可以! Google just gave us a fantastic Thanksgiving Day present in the form of Google Profiles supporting OpenID. Google刚刚以支持OpenID的Google个人资料的形式给了我们一个美好的感恩节礼物。 And with a Google Profile, you get to pick a named URL of your choice! 有了Google个人资料,您就可以选择一个命名的URL!

您的问题的端点URL是正确的(以/ud结尾的端点),但是您的示例代码将请求发送到标识符URL( /id ),而不是端点URL。

My above code do return https://www.google.com/accounts/o8/ud in $url, which is correct actually 我上面的代码确实在$ url中返回https://www.google.com/accounts/o8/ud ,这实际上是正确的

the problem is, you do not need to use openid php lib, just redirect the user to https://www.google.com/accounts/o8/ud with query string like: 问题是,您不需要使用openid php lib,只需使用以下查询字符串将用户重定向到https://www.google.com/accounts/o8/ud即可

https://www.google.com/accounts/o8/ud?openid.mode=checkid_setup& ...... https://www.google.com/accounts/o8/ud?openid.mode=checkid_setup& ......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM