mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
✨ Add GoogleDrive-Node
This commit is contained in:
22
packages/nodes-base/nodes/Google/GoogleApi.ts
Normal file
22
packages/nodes-base/nodes/Google/GoogleApi.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user