Google API using Json Web Token

I am not sure what I am doing wrong here. This information came from JSON file from Google Developer Console. Am I pasting the Key incorrectly?

From a quick look I think the last \n shouldn’t be there in the key.

Like this? I downloaded the key from the dev console

BEFORE: [...]7oF95UmBJ3\n-----END PRIVATE KEY-----\n
AFTER: [...]7oF95UmBJ3-----END PRIVATE KEY-----

My bad. Did you copy the token from the json downloaded from the cloud console?
If yes then you need to replace all \n with newlines.

It’s probably to do with the line break chars being \n encoded within the key. Your keys should look like this (but 64 chars wide I think it is)


Not like this


You can manually replace the \n with entering a keyboard renew line - or do it with some code.

I’ve some links I can add to this in the morning if it isn’t solved by then :slightly_smiling_face:

1 Like

An easy way is to copy the whole key from the json including " before and after, and pasting it in the developer tools console of the browser. It will output the text in the format you need ready to be copied.

Thank you both very much, it works. \n had to be replaced across the entire file, not just beginning and end.