google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.59k stars 428 forks source link

Error retrieving access token: TypeError: Cannot destructure property 'client_id' of 'options.creds.installed' as it is undefined. #917

Open KnuddelsMasterChris opened 2 years ago

KnuddelsMasterChris commented 2 years ago

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

1. 1.

Specifications

andkirby commented 2 years ago

My case:

$ clasp login --creds .clasprc.json
Warning: You seem to already be logged in *locally*. You have a ./.clasprc.json
Logging in locally…

Authorizing with the following scopes:
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/script
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/script.webapp.deploy

NOTE: The full list of scopes your project may need can be found at script.google.com under:
File > Project Properties > Scopes

Error retrieving access token: TypeError: Cannot destructure property 'client_id' of 'options.creds.installed' as it is undefined.

It's really not clear what should I fix...

andkirby commented 2 years ago

Another question: How options.creds.installed shall be defined in a local credentials file? It is mentioned in: https://github.com/google/clasp/blame/e851215b8abe4de282c62c4d61076c85e89a56ba/src/auth.ts#L113 I don't see any way to generate such .clasprc.json with installed property.

paul-messina-mm commented 2 years ago

Same with node v14.18.2 clasp 2.4.1 on MacOs Big Sur 11.6.4

clasp login --creds .clasprc.json 
Warning: You seem to already be logged in *locally*. You have a ./.clasprc.json
Logging in locally…

Authorizing with the following scopes:
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/script.webapp.deploy

NOTE: The full list of scopes your project may need can be found at script.google.com under:
File > Project Properties > Scopes

Error retrieving access token: TypeError: Cannot destructure property 'client_id' of 'options.creds.installed' as it is undefined.
sbwrege2z commented 1 year ago

Same for me.

node v12.20.1 clasp v2.4.2

clasp login --creds ./credentials/clasp-trn-creds.json                             1 ↵  9012  12:16:18
Logging in locally…

Authorizing with the following scopes:
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/script.scriptapp
https://www.googleapis.com/auth/script.container.ui
https://www.googleapis.com/auth/script.webapp.deploy

NOTE: The full list of scopes your project may need can be found at script.google.com under:
File > Project Properties > Scopes

Error retrieving access token: TypeError: Cannot destructure property 'client_id' of 'options.creds.installed' as it is undefined.
bdetry commented 1 year ago

Almost the same issue here when trying clasp login --creds with a service account key file.

I have added the installed json key and got this error :

Error retrieving access token: TypeError: Cannot read properties of undefined (reading '0')

vlad-yavorsky commented 1 year ago

This answer helped me: https://stackoverflow.com/a/65456893/8668096 or this: https://stackoverflow.com/a/43640000

lgnashold commented 1 year ago

Still experiencing this. It's also not even clear from the documentation how to create an account locally, or the distinction between a local and global account.