Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const functions = require('firebase-functions');
- // firebase admin
- const admin = require('firebase-admin');
- admin.initializeApp(functions.config().firebase);
- // google sheet api
- const google = require('googleapis');
- const key = require('./key/serviceKey.json');
- const scopes = [
- 'https://www.googleapis.com/auth/spreadsheets',
- 'https://www.googleapis.com/auth/drive'
- ];
- const authClient = new google.auth.JWT(
- key.client_email, null, key.private_key, scopes, null
- );
- authClient.authorize((err, tokens) => {
- if (err) {
- console.log('error occurred when authorising with JWT');
- } else {
- console.log('auth success, tokens', tokens);
- google.options({ auth: authClient });
- }
- });
- const drive = google.drive('v2');
- const sheets = google.sheets('v4');
Add Comment
Please, Sign In to add comment