为什么 Net::OpenID::Consumer 在尝试获取 Google 的 OpenID 发现端点时会失败?

发布于 2024-08-03 23:24:49 字数 1136 浏览 0 评论 0原文

我正在为公共网站实现 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2024-08-10 23:24:49

解决了。代码没有任何问题。我部署的机器是 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. ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文