Creating Service Account flow has changed within Developer console causing confusion in steps below.
I am trying to use your package and noticed that the steps listed below have now been modified while in Google's console:
- Under "OAuth", click the "Create new client ID" button.
- Select "Service account" as the application type and click "Create Client ID".
When I click on "Create Credentials" I have a services account option in the dropdown. Once I select that and follow the rest of your steps I'm hitting an error while running the following code:
var googleAuth = require('google-oauth-jwt');
googleAuth.authenticate({
email: '[email protected]',
keyFile: 'my-service-account-key.pem',
scopes: ['https://www.googleapis.com/auth/drive.readonly']
}, function (err, token) {
console.log(token);
});
I receive the following Error: Error: failed to obtain an authentication token, request failed with HTTP code 401: invalid_client.
I didn't see a clientId in the new service account process, but I might have made a mistake somewhere. Thank you again for your time.
You can find your clientid and secret in the developer console under API Manager, Credentials, Web Application Client for OAuth2 ClientIDs. Once I'm editing the right entry, I see the clientID, secret, JSON download and such at the top of the page and the URL is like: https://console.developers.google.com/apis/credentials/oauthclient/some-guid-specific-to-me.apps.googleusercontent.com?project=my-project-name
I'm attaching a screenshot of what it looks like too.