When does user.user_id() change on App Engine app using OpenID authentication?
I have an application using vanilla OpenID support from GAE platform. I use user_id()
as an common — as I understand immutable — id for everything concerning users.
But from time t开发者_运维技巧o time I notice that user_id changes for some users. What causes the change in user_id for a user?
It shouldn't ever change. What circumstances do you see it change in? How do you determine it's the same user?
On the other hand, the Google OpenID provider acts in a way that is domain-dependent: when a user signs in with their Google account, it generates a new, custom OpenID URL that depends on the domain they're signing in to. If your app exists on multiple domains, and authenticates users on each, you'll get a different OpenID URL (and hence user_id) for the same user on each domain.
This is a consequence of how the Google OpenID provider works, unfortunately, and there's not really any way around it, other than either only serving on one domain, or asking your users to combine their OpenID URLs.
精彩评论