Tuesday, 20 March 2018

Help with Google service account auth (Invalid JWT Signature)

Good day /r/nodeI am currently struggling with an error with regards to getting an auth token from Google using the >googleapis node module.I keep receiving the following error:invalid_grant: Invalid JWT Signature.I have created the service account and granted it all permissions in the google developer console. I have enabled the analytics API that I am trying to access as well.This is the code:let { google } = require('googleapis'); let privatekey = require('../config/keys/CCKey.json'); let jwtClient = new google.auth.JWT( privatekey.client_email, null, privatekey.private_key, 'http://ift.tt/15Q8qQj', null ); //authenticate request jwtClient.authorize(function (err, tokens) { if (err) { console.log(err); return; } else { console.log(tokens); } }); The json file was generated when creating the service account, I honestly don't know what to try anymore. Have been trying to figure this out for 5-6 hours.Does anyone possibly have any idea why I am getting this error?

Submitted March 20, 2018 at 06:52AM by thezadmin

No comments:

Post a Comment