if i have the key of google openid when someone who login my site,how do i get the username
if the key is https://www.google.com/accounts/o8/id?id=AItOawmqS0V2RR5FihojGdC90vXJpjcukoZ
how do i get the username who log开发者_JS百科in my site ?
thanks
I am afraid, that with OpenID, the URL really is the closest thing to a user name. According to Wikipedia:
Unlike a typical login form with fields for the user name and password, the OpenID login form has only one field—for the OpenID identifier, typically along with a small OpenID logo.
If you go to your own profile page here on StackOverflow, you should see a field named openid
, containing the URL you are authenticated with. SO does not know which user name (if any) you use to authenticate with your OpenID provider.
However, it is possible (but not guaranteed) for login providers to provide a "nick name" for the user signed in. If it exists, it should be part of the response you get from the OpenID provider. Typically, you will want to add "user name" a field in your data model, and allow the user to supply a value for this field upon first login - initialized to nick name if available.
Yup, the point with OpenID if you still need them to have an identifier to your page / site is to have a backend DB that attributes that key (openid url) with their identifier (key / username) on your site.
So googles A410d314 OpenID URL key is your 'superuser23' username. It can be a many to one correlation in a way and they can all point to 'superuser23'.
精彩评论