What should I set REALM to, using LightOpenID, for Google url's to remain consistent, for storage in my database?

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

  •  12-11-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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.

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