node-samples
node-samples copied to clipboard
TypeError: Cannot destructure property 'client_secret' of 'credentials.installed ' as it is undefined.
Expected Behavior
Actual Behavior
Steps to Reproduce the Problem
Specifications
- Node version (
node -v) - OS (Mac/Linux/Windows)
Same as Issue #92
Same as issue #92
Same as issue #92
change credentials.installed to credentials.web
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.
Oh man, I haven't used this since my last comment, try mentioning a contributor or something, @working-name
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.
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?
I'd open another issue, might get a contributor to help out maybe
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()