Why does Net::OpenID::Consumer fail when trying to grab Google's OpenID discovery endpoint?

StackOverflow https://stackoverflow.com/questions/1361492

  •  20-09-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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. ;-)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top