title: Google App Engine Java - Federated Login, what to keep in Datastore
body: <p>I'm building a Google App Engine for Java app using Federated login.  </p>
  
  <p>When a user has logged into my app using an OAuth provider I get a User object back [http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/users/User.html].</p>
  
  <p>I want to persist a link to that user in the datastore.  However, what do I use as the unique key?  Is it the getFederatedIdentity() or getUserId() ?  There is hardly any JavaDoc on either.  Obviously when a user subsequently logs into my app I want to retrieve the Object I have saved to the datastore.  </p>
  
  <p>I understand the federatedIdentity field, which I understand should always be populated (I only allow federated logons).  However, if that's the field to use to link my details to the logged on user, then Google leaves this empty when testing on the local server... so that wouldn't be much use.</p>
  
  <p>What is the getUserId field - how does Google set it?  Will it guarantee to stay the same if the user's federated identity stays the same?</p>
  
  <p>Thanks a lot</p>