Recently, I noticed that when storing the resulting identity in my database, Google would sometimes return a different identity for the same user, resulting in two database entries for a single user.
After a little research, I figured out that Google uses $openid-开发者_运维百科>realm along with the username to create the identity. And by default the realm becomes the URL of your website. Using LightOpenID, what should I set $openid->realm to for the resulting Google identities to remain consistent, so that I can store them in my database? Can I just set 'realm' to whatever I like? Or does it have to relate to my URL?
I looked at the spec:
http://openid.net/specs/openid-authentication-2_0.html#realms
After some trial and error, I ended up using http://*.mydomain.com as the realm and my problem was solved. Google would always return the same identity. Originally I was trying simply *.mydomain.com and that was creating an error.
精彩评论