In our GAE application we process user`s documents in google drive and as this process takes sometimes more then 30seconds we are getting deadline exception as it is GAE frontend instance.
we would like to use backend instance. Problem is how to pass credentials (com.google.api.client.auth.oauth2.Credentials) to be able to initialize Google drive API.
How to pass user credentials into GAE task queue and then to backend instance to be able to use them later when task will be running ?
com.google.api.client.auth.oauth2.Credentials is not serializable ...
Is there any way ?
You’ll need to keep the inputs to the credential so you can re-create it in the backend handler.
This is either an authorization code, or the access token and refresh token that you got in exchange for the authorization code. They’re all strings so should serialize readily.
If all that sounds unfamiliar, I’d be curious to understand how you got the Credential in the first place. Links to useful documentation below:
Notably, sample code in that last link specifically includes a method that you’re expected to implement to squirrel away the access/refresh tokens: