com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
mahichachra opened this issue · comments
getting this error
Exception in thread "main" com.google.api.client.auth.oauth2.TokenResponseException: 400 Bad Request
POST https://oauth2.googleapis.com/token
{
"error" : "invalid_scope",
"error_description" : "Invalid OAuth scope or ID token audience provided."
}
at com.google.api.client.auth.oauth2.TokenResponseException.from(TokenResponseException.java:105)
at com.google.api.client.auth.oauth2.TokenRequest.executeUnparsed(TokenRequest.java:326)
at com.google.api.client.auth.oauth2.TokenRequest.execute(TokenRequest.java:346)
Code snippet
public static Compute createComputeService() throws IOException, GeneralSecurityException {
logger.info("Entered createComputeService");
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
GoogleCredential credentials = GoogleCredential.getApplicationDefault();
return new Compute.Builder(httpTransport, jsonFactory, credentials)
.setApplicationName("Google-xyz/0.1")
.build();
}
Is it resoved?
It got resolved by setting scope
It got resolved by setting scope
what scope ?