How to correctly implement abstract getUserId(request) method in these Google OAuth2 abstract servlets?
As code says, it is used to lookup and store google credential. I've seen example which returns session id, but that won't work correctly after session expiration:
- User visits auth url, his access and refresh token are stored in storage under sessionId key
- Within session lifetime, everythings works fine, so if this user visits auth url again, his stored tokens are found with the same sessionId key
- But after session expiration (server restart etc) when this user visits auth url again, he gets new sessionId, no stored tokens are found, so new tokens (this time only access token) are requested and stored again under new sessionId key
So the question is - how to generate userId that will work in all cases? GoogleAppEngine implementation uses logged user, which is perfectly fine - but how do I generate such userId from just HttpRequest parameter?
BTW this (https://developers.google.com/gmail/api/auth/web-server) python implementation seems to generates parallel userinfo request to get user email manually...