Skip to content Skip to sidebar Skip to footer

Gae: Can't Use Google Server Side Api's (whitelisting Issue)

To use Google API's, after activating them from the Google Developers Console, one needs to generate credentials. In my case, I have a backend that is supposed to consume the API s

Solution 1:

You can use App Identity to access Google's API from AppEngine. See: https://developers.google.com/appengine/docs/python/appidentity/. If you setup your app using the cloud console, it should have already added your app's identity with permission to your project, but you can always check that out. From the "Permissions" Tab in cloud console for your project, make sure your service account is added under "Service Accounts" (in the form of your_app_id@appspot.gserviceaccount.com)

Furthermore, if you use something like the JSON API Libs available for python, you can use the bundled oauth2 library to do all of this for you using AppAssertionCredentials to authorize the API you wish to use. See: https://developers.google.com/api-client-library/python/guide/google_app_engine#ServiceAccounts

Solution 2:

Yes, you should use App Identity. Forget about getting an IP or giving up on GAE :-) Here is an example of how to use Big Query, for example, inside a GAE application:

static {
    // initializes Big QueryJsonFactoryjsonFactory=newJacksonFactory();
    HttpTransporthttpTransport=newUrlFetchTransport();
    AppIdentityCredentialcredential=newAppIdentityCredential(Arrays.asList(Constants.BIGQUERY_SCOPE));
    bigquery = newBigquery.Builder(httpTransport, jsonFactory, credential)
            .setApplicationName(Constants.APPLICATION_NAME).setHttpRequestInitializer(credential)
            .setBigqueryRequestInitializer(newBigqueryRequestInitializer(Constants.API_KEY)).build();
}

Post a Comment for "Gae: Can't Use Google Server Side Api's (whitelisting Issue)"