Automatically remove new lines from Google credentials

This commit is contained in:
Jan Oberhauser
2021-12-24 10:48:23 +01:00
parent 205ae0986f
commit 185bc04436
7 changed files with 31 additions and 17 deletions

View File

@@ -95,6 +95,8 @@ function getAccessToken(this: IExecuteFunctions | ILoadOptionsFunctions, credent
const now = moment().unix();
const privateKey = (credentials.privateKey as string).replace(/\\n/g, '\n');
const signature = jwt.sign(
{
'iss': credentials.email as string,
@@ -104,11 +106,11 @@ function getAccessToken(this: IExecuteFunctions | ILoadOptionsFunctions, credent
'iat': now,
'exp': now + 3600,
},
credentials.privateKey as string,
privateKey as string,
{
algorithm: 'RS256',
header: {
'kid': credentials.privateKey as string,
'kid': privateKey as string,
'typ': 'JWT',
'alg': 'RS256',
},