google / clasp

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

clasp login` fails with `--creds` option #784

Open saito-ya opened 4 years ago

saito-ya commented 4 years ago

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

Expected Behavior

Success clasp login --creds creds.json and it is able to log in with my own credential.

Actual Behavior

Run clasp login --creds creds.json and get the following error message.

Logging in locally...

No valid .clasp.json project file. You may need to `create` or `clone` a project first.

Steps to Reproduce the Problem

  1. Go to APIs & Services > Credentials of my GCP project.
  2. Create OAuth 2.0 Client IDs (with type of Desktop)
  3. Download the credential json file
  4. run npm i clasp -g and install clasp globally
  5. run clasp login --creds path_to_credential.json

Specifications

PopGoesTheWza commented 4 years ago

@saito-ya can you test with the #791 unofficial release?

npm uninstall -g @google/clasp && npm install -g forked-clasp
clasp --version
# should be 2.4.0 or more
sqrrrl commented 3 years ago

Intended behavior to require an existing project. --creds is really only used to set up auth for the run command and it does some other things in the associated GCP project.

Since it's a bit more specialized than the login command implies, may revisit this in 3.0 and break it out to a separate command to configure the run command.