问题
After logging into SO, my nickname shows up at the top.
When I set up openid on my site, I do not get any profile information.
I tried implementing OpenID using openid-selector and Zend Framework
The response parameters I get:
openid.assoc_handle B2Jgsdf7jkDsdfUwWBGMHUshLmavymH...
openid.claimed_id https://me.yahoo.com/MyYahooId#50a9f
openid.identity https://me.yahoo.com/MyYahooId
openid.mode id_res
openid.ns http://specs.openid.net/auth/2.0
openid.ns.pape http://specs.openid.net/extensions/pape/1.0
openid.op_endpoint https://open.login.yahooapis.com/openid/op/auth
openid.pape.auth_level.nist 0
openid.pape.auth_level.ns.nist http://csrc.nist.gov/publications/nistpubs/800-63/SP800-63V1_0_2.pdf
openid.pape.auth_policies http://schemas.openid.net/pape/policies/2007/06/none
openid.realm http://mywebsite.com/
openid.response_nonce 2009-10-28T18:23:05Zyj0aF9sdfsdfCmoegeAiQ--
openid.return_to http://mywebsite.com/
openid.sig U9O4UpuPsdfdsfsdfBHbVLdjiSyo=
openid.signed assoc_handle,claimed_id,identity,mode,ns,op_endpoint,response_nonce,return_to,signed,ns.pape,pape.auth_level.ns.nist,pape.auth_level.nist,pape.auth_policies
What is the reason I do not receive profile information such as nickname? When SO uses openid-selector, how does it get the nickname?
回答1:
Any information aside from claimed_id and endpoint URL must be retrieved via Simple Registration (SREG) or Attribute Exchange (AX) extensions to OpenID.
You must explicitly request for them when asking for authentication.
Zend's consumer SREG documentation can be found here: http://framework.zend.com/manual/en/zend.openid.consumer.html#zend.openid.consumer.sreg
Note that these information are not guaranteed, and providers are given the freedom to decide (with or without user input) to withhold any and all requested information, or not support them outright.
来源:https://stackoverflow.com/questions/1639196/how-to-get-openid-user-profile-info