diff --git a/gdrive.js b/gdrive.js index 6b44b07..e77f6a8 100644 --- a/gdrive.js +++ b/gdrive.js @@ -11,6 +11,11 @@ const delay = (ms) => { class GDrive { constructor () { + // Hack to fix knot problem with key that has spaces and new lines. + // TODO: Replace with base64 encoding and decoding. + let PRIVATE_KEY = process.env.PRIVATE_KEY + PRIVATE_KEY = PRIVATE_KEY.replace(//g, ' ') + PRIVATE_KEY = PRIVATE_KEY.replace(//g, '\n') this.driveOptions = { pageSize: 200, corpora: 'teamDrive', @@ -22,7 +27,7 @@ class GDrive { this.authCredentials = [ process.env.CLIENT_EMAIL, null, - process.env.PRIVATE_KEY, + PRIVATE_KEY, ['https://www.googleapis.com/auth/drive'], process.env.USER_EMAIL, ] diff --git a/package.json b/package.json index f5b9858..c62aa2f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@knotel/gdrive-lib", "description": "Library for building/fetching Google Team Drive metadata in nested JSON format", - "version": "0.0.10", + "version": "0.0.11", "main": "gdrive.js", "repository": "git@github.com:knotel/gdrive-lib.git", "author": "cfaruki@knotel.com",