I'm currently creating a Glassware
application that is Java
based and hosted on Google App Engine
. Everything is going great... except for some reason AuthUtil
stops being able to find the Credentials object for a user who submits a POST request.
When the user first navigates to my application's home page and signs in/authenticates with their Google Account
everything works perfectly. The first card is posted to their timeline and the server responds appropriately to all incoming POSTS. But if the server sits idle for about 15-20 minutes then all POST requests begin failing.
After some debugging I found that AuthUtil.getCredential
is no longer returning the user's Credential
object after sitting idle for a short amount of time. The only way to correct this is to force the user to go back to my home page and re-sign in/authenticate.
Here is a snippet of the code that my application's servlet is using in "doPost":
Notification notification = jsonFactory.fromString(notiString, Notification.class);
String userId = notification.getUserToken();
LOG.info("SERVLET - Request contained user token: " + userId);
Credentials currUser = AuthUtil.getCredential(userId);
if (currUser != null)
{
LOG.info("SERVLET - User found");
}
else
{
LOG.severe("SERVLET - User NOT FOUND");
}
NOTE: I can confirm that all incoming POSTs include the user's token identifier string.