node-samples icon indicating copy to clipboard operation
node-samples copied to clipboard

TypeError: Cannot destructure property 'client_secret' of 'credentials.installed ' as it is undefined.

Open salmansrabon opened this issue 5 years ago • 10 comments
trafficstars

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

Specifications

  • Node version (node -v)
  • OS (Mac/Linux/Windows)

salmansrabon avatar Jul 11 '20 12:07 salmansrabon

Same as Issue #92

billythemusical avatar Jul 11 '20 21:07 billythemusical

Same as issue #92

kingmaker9841 avatar Aug 27 '20 04:08 kingmaker9841

Same as issue #92

sidharathjain2 avatar Sep 23 '20 14:09 sidharathjain2

change credentials.installed to credentials.web

alechash avatar Dec 17 '20 19:12 alechash

change credentials.installed to credentials.web

More context please, I've grepped the project folder, and all clasp json every where, no hits. It also seems you need to manually generate .clasprc.json ?! Terrible documentation on this process.

working-name avatar Aug 23 '21 22:08 working-name

Oh man, I haven't used this since my last comment, try mentioning a contributor or something, @working-name

alechash avatar Aug 24 '21 18:08 alechash

Oh man, I haven't used this since my last comment, try mentioning a contributor or something, @working-name

Thank you much for replying! That's quite alright, I ended up giving up on clasp run, just doing a POST from AS to log things more easily.

working-name avatar Aug 24 '21 18:08 working-name

is there any way to get this to work with a service account for server to server, so we don't need a redirect URL?

dcsan avatar Sep 11 '21 14:09 dcsan

I'd open another issue, might get a contributor to help out maybe

alechash avatar Sep 12 '21 00:09 alechash

in case anyone needs this for sheets I gave up with the oauth examples in this repo and just used something like this

const fs = require('fs')

const { google } = require('googleapis');
const docs = require('@googleapis/docs')

// replace these two
const credsPath = './your-service-account.json';
const sheetId = 'XXXX-your-sheet-id'

async function getAuth() {

    const auth = new docs.auth.GoogleAuth({
        keyFilename: credsPath,
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: [
            'https://www.googleapis.com/auth/spreadsheets.readonly',
            'https://www.googleapis.com/auth/spreadsheets'
        ]
    });
    const authClient = await auth.getClient();
    return auth;
}


async function fetchClues(auth: any): Promise<any[]> {
    const sheets = google.sheets({ version: 'v4', auth });
    const result = await sheets.spreadsheets.values.get({
        spreadsheetId: sheetId,
        range: 'YOUR-TAB-NAME!A1:E100',
    })
    return result.data.values;
}

async function main () {
    await DbConn.connect()
    const auth = await getAuth();
    const rows: any[] = await fetchClues(auth);
    // do stuff with your data
    DbConn.close() // or the process won't close
}

process.on('unhandledexception', (err) => {
    console.log('unhandledexception', err);
});



main()

dcsan avatar Sep 12 '21 00:09 dcsan