Add GoogleDrive-Node

This commit is contained in:
Jan Oberhauser
2019-10-27 21:44:21 +01:00
parent 713535087f
commit a94d289d81
7 changed files with 980 additions and 13 deletions

View File

@@ -0,0 +1,22 @@
import { JWT } from 'google-auth-library';
import { google } from 'googleapis';
/**
* Returns the authentication client needed to access spreadsheet
*/
export async function getAuthenticationClient(email: string, privateKey: string, scopes: string[]): Promise <JWT> {
const client = new google.auth.JWT(
email,
undefined,
privateKey,
scopes,
undefined
);
// TODO: Check later if this or the above should be cached
await client.authorize();
return client;
}