perl - Attributes exchange using Net::OpenID::Consumer -
my $csr = net::openid::consumer->new( ua => lwp::useragent->new, consumer_secret => '123456xxx', required_root => "http://www.myopenidsample.net/", ); $openid = "https://me.yahoo.com"; $claimed_id = $csr->claimed_identity($openid); if ($claimed_id){ $check_url = $claimed_id->check_url( delayed_return => 1, return_to => "http://www.myopenidsample.net/response.cgi", trust_root => "http://www.myopenidsample.net/", ); print $q->redirect($check_url); }
how attributes such email, firstname, lastname, , country? how append following parameters url?
openid.ext1.mode fetch_request openid.ext1.required country,email,firstname,lastname,language openid.ext1.type.country http://axschema.org/contact/country/home openid.ext1.type.email http://axschema.org/contact/email openid.ext1.type.firstname http://axschema.org/nameperson/first openid.ext1.type.language http://axschema.org/pref/language openid.ext1.type.lastname http://axschema.org/nameperson/ openid.ns.ext1 http://openid.net/srv/ax/1.0
you need add following code before call check_url
(the example tested google in order email):
$claimed_id->set_extension_args( "http://openid.net/srv/ax/1.0", { 'mode' => 'fetch_request', 'type.email' => 'http://axschema.org/contact/email', 'required' => 'email', });
to value in return, use:
$email = $csr->message->get_ext ("http://openid.net/srv/ax/1.0", "value.email");
Comments
Post a Comment