Generating a unique data store key from a federated identity

Go To StackoverFlow.com

2

I need a unique datastore key for users authenticated via openid with the python 2.7 runtime for the google apps engine.

Should I use User.federated_identity() or User.federated_provider() + User.federated_identity()?

In other words is User.federated_identity() unique for ALL providers or just one specific provider?

2012-04-03 22:13
by Shawn Church


2

User.federated_identity() "Returns the user's OpenID identifier.", which is unique by definition (it's a URL that uniquely identifies the user).

2012-04-05 06:13
by Nick Johnson
Thanks for responding Nick. My confusion was with the GAE documentation which states that the User.userid() will return None for non-google accounts. At least in my initial (cloud) testing it appeared to return a value for all open id providers. Since I was using the idiom ".userid() or .federatedid()" I never saw the actual federatedid value. I changed my logic to user userid when on the development server and federatedid otherwise and now I can see that they are obviously unique - Shawn Church 2012-04-05 07:54