0

I have just come across Google App engine and am trying to develop a site on it. Part of the site should allow users to log in. I plan to offer two options.

  1. log in using my own implemented account manager with sessions and whatnot - not to hard according to this SO question
  2. Log in using an open ID account

When using my own log in form I can force a unique identity to be created through an email address/user name field, etc. but how can I get a unique identity from an open id user? Are they guarantied to have supplied an email - as in will the user service give me a user object that is guarantied to have an email?

Thanks a lot for any advice

Community
  • 1
  • 1
Saad Attieh
  • 1,396
  • 3
  • 21
  • 42

1 Answers1

0

To get the unique identifier for a user, use User#getUserId().

Returns an opaque string that uniquely identifies the user represented by this User object.

In case of open ID account, you can also use User#getFederatedIdentity(), however, I would say that it does not have to return always the unique identifier.

There are two flavors of provider types: direct providers like Google and Yahoo! require only a generic federated identity that has no username associated with it.

In contrast, Flickr, WordPress, Blogger, and LiveJournal are known as username providers because all require you to provide a URL which does.

See more details here.

Anyway there is also a possibility to store the user object as a whole. This is supported out of the box by App Engine and Datastore.

pgiecek
  • 7,970
  • 4
  • 39
  • 47