Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Default Credentials not working locally with App Engine

Having a tough time getting the Default Application Credentials to load in the dataflow SDK when running locally in a java app engine project developing on OS X. Runs fine when deployed.

According to this the dev app server doesn't support them, and you're meant to use the gcloud command line tool's command: gcloud preview app run - but according to the official Google Group for the SDK here that command was deprecated in Jan 2016.

So I seem to be stuck between a rock and a hard place... Does anyone know how to get the Application Default Credentials to work locally with an App Engine app?

I'm trying to use the Dataflow API and it just throws up when it starts making use of the cloud storage api which is the first thing the Pipeline does because it can't seem to load the correct credentials from the environment variables ( that are definitely set on the ENV and in the appengine-web.xml <env-variables> element ) or from the ~/.config/cloud/default_application_credentials.json file.

Cheers!

like image 575
Tom Newton Avatar asked Feb 19 '16 16:02

Tom Newton


People also ask

Where are application default credentials stored?

Credentials are stored in two files: access_tokens. db and credentials. db in that directory.

How do I set a default App Engine service account?

In the Google Cloud console, go to the IAM page. Select your project. Locate the App Engine default service account in the Principals list. The App Engine default service account appears in the list if roles have been automatically or manually granted to the service account.

What is Application default credentials in GCP?

Application Default Credentials (ADC) ADC is a strategy used by Cloud Client Libraries and Google API Client Libraries to automatically find credentials based on the application environment, and use those credentials to authenticate to Google Cloud APIs.


2 Answers

Can you try running the following command and see if it solves it?

gcloud auth application-default login
like image 78
Nacho Coloma Avatar answered Oct 21 '22 06:10

Nacho Coloma


This is fully supported (but poorly documented) within the dev appserver. There is a very well answered question that gives you step by step instructions here: Unable to access BigQuery from local App Engine development server

like image 3
Jesse Avatar answered Oct 21 '22 04:10

Jesse