fix: Fix issue with key based credentials not being read correctly (#6824)

This commit is contained in:
Jon
2023-08-09 12:30:53 +01:00
committed by GitHub
parent 6553d92c7c
commit db21a8db75
10 changed files with 114 additions and 69 deletions

View File

@@ -11,6 +11,8 @@ import type { OptionsWithUri } from 'request';
import moment from 'moment-timezone';
import * as jwt from 'jsonwebtoken';
import { formatPrivateKey } from '@utils/utilities';
const googleServiceAccountScopes = {
bigquery: ['https://www.googleapis.com/auth/bigquery'],
books: ['https://www.googleapis.com/auth/books'],
@@ -69,7 +71,7 @@ export async function getGoogleAccessToken(
const scopes = googleServiceAccountScopes[service];
const privateKey = (credentials.privateKey as string).replace(/\\n/g, '\n').trim();
const privateKey = formatPrivateKey(credentials.privateKey as string);
credentials.email = ((credentials.email as string) || '').trim();
const now = moment().unix();