Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
salmansrabon opened this issue Jul 11, 2020 · 10 comments

Comments

@salmansrabon
Copy link

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

Specifications

  • Node version (node -v)
  • OS (Mac/Linux/Windows)
@billythemusical
Copy link

Same as Issue #92

@kingmaker9841
Copy link

Same as issue #92

1 similar comment
@sidharathjain2
Copy link

Same as issue #92

@alechash
Copy link

change credentials.installed to credentials.web

@working-name
Copy link

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.

@alechash
Copy link

alechash commented Aug 24, 2021

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

@working-name
Copy link

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.

@dcsan
Copy link

dcsan commented Sep 11, 2021

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?

@alechash
Copy link

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

@dcsan
Copy link

dcsan commented Sep 12, 2021

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants