Reputation: 2614
I'm adding BigQuery support to my App Engine app and getting stuck on OAuth2, specifically when testing on the dev server (deployed test works).
The most App-Engine specific and current advice I could find, here: https://developers.google.com/bigquery/authorization#service-accounts-appengine
Suggests this:
if (System.getProperty("OAUTH_ACCESS_TOKEN") != null) {
// Good for testing and localhost environments, where no AppIdentity is available.
return new GoogleCredential().setAccessToken(System.getenv("OAUTH_ACCESS_TOKEN"));
}
What would I set the OAUTH_ACCESS_TOKEN to? Is this something I'd hardcode in my settings (I thought access tokens were temporary?) or would I set it programatically?
Upvotes: 1
Views: 614
Reputation: 2614
In the absence of an answer, my workaround was to create a GoogleCredential using the process described here: https://developers.google.com/bigquery/docs/authorization#service-accounts-server
I therefore use the GAE-specific instructions when deployed and use the key-file rigmarole when on the dev server.
Upvotes: 1