I have Google Compute Engine's Credentials file , renamed as key.json. The next step is to set the environment variable with name GOOGLE_APPLICATION_CREDENTIALS. But it says error: Error reading credential file from environment variable GOOGLE_APPLICATION_CREDENTIALS ...path.. Error reading credentials from stream, 'type' field not specified.
httpTransport = GoogleNetHttpTransport.newTrustedTransport();
GoogleCredential credential = GoogleCredential.getApplicationDefault();
I want to know how to set variable GOOGLE_APPLICATION_CREDENTIALS in eclipse?
API authenticationIn the OAuth 2.0 Playground, click Cloud Storage API v1, and then select an access level for your application ( full_control , read_only , or read_write ). Click Authorize APIs. Sign in to your Google account when prompted. In the dialogue that appears, click Allow.
You got the error because you downloaded an OAuth 2.0 Client ID instead of a Service Account key.
If you want to use regular user credentials as the application default, you can now use the gcloud beta auth application-default login
command to launch the web sign-in flow. This puts them in the well-known location for application default credentials, so you should unset the GOOGLE_APPLICATION_CREDENTIALS variable if you use this method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With