为什么 Net::OpenID::Consumer 在尝试获取 Google 的 OpenID 发现端点时会失败?
我正在为公共网站实现 OpenID 支持。雅虎和 Verisign openid 身份验证目前工作正常。但是,我似乎无法连接到 Google 的端点。 下面是代码:
常见的初始化和东西...
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new(),
consumer_secret => time,
args => CGI->new(),
debug => 1,
);
my $claimed_identity =
$csr->claimed_identity('https://www.google.com/accounts/o8/id');
my $check_url = $claimed_identity->check_url(
return_to => "http://bla.com/openid",
trust_root => "http://bla.com",
delayed_return => 1,
);
print $check_url, "\n";
...其他东西
错误总是相同的: url_fetch
_error: 获取 URL 时出错:未找到
A. 这里有两个谜团。我可以直接使用 LWP 并从 https://www.google.com/accounts 获取 XRDS 文件/o8/id 没有问题。
B. 使用相同的代码,但将端点发现 URL 更改为“https://me.yahoo.com”工作得很好。
如何让我的代码与 Google 兼容?我很困惑为什么我不为谷歌工作,而它却为雅虎和威瑞信工作。有什么想法吗?
I'm implementing OpenID support for a public website. Yahoo and Verisign openid authentication currently works fine. However, I cannot seem to connect to Google's endpoint.
Below is the code:
Usual initialization and stuff...
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new(),
consumer_secret => time,
args => CGI->new(),
debug => 1,
);
my $claimed_identity =
$csr->claimed_identity('https://www.google.com/accounts/o8/id');
my $check_url = $claimed_identity->check_url(
return_to => "http://bla.com/openid",
trust_root => "http://bla.com",
delayed_return => 1,
);
print $check_url, "\n";
... other stuff
The error is always the same:
url_fetch
_error: Error fetching URL: Not Found
A. There are two mysteries here. I can use LWP directly and grab the XRDS file from https://www.google.com/accounts/o8/id wih no issues.
B. Using same code, but changing the endpoint discovery url to "https://me.yahoo.com" works perfectly fine.
How do I make my code work with Google? I'm quite baffked why I doesn't work for Google when it works for Yahoo and Verisign. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。代码没有任何问题。我部署的机器是 Debian Lenny。安装的 Net::OpenID::Consumer 版本确实很旧:版本 0.14。我通过CPAN将其升级到最新版本(1.03)。该代码现在可以完美地处理 Google、Yahoo 和 Verisign OpenID 端点和身份验证。即将添加 Live Mail (Hotmail)。 ;-)
Solved. There's nothing wrong with the code. The machine I deployed to was a Debian Lenny. The installed version of Net::OpenID::Consumer was really old : version 0.14. I upgraded it to the latest version (1.03) via CPAN. The code now handles Google, Yahoo and Verisign OpenID endpoints and authentication flawlessly. Going to add Live Mail (Hotmail) soon. ;-)