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

clasp login --no-localhost No Longer Working #948

Open starkprime opened 1 year ago

starkprime commented 1 year ago

Access blocked: clasp – The Apps Script CLI’s request is invalid This might be due to this: https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html#instructions-oob

Steps to Reproduce the Problem

  1. clasp login --no-localhost
lfourreau commented 1 year ago

is there a workaround because we have the same problem ?

starkprime commented 1 year ago

The workaround I use is locally doing a normal clasp login on your local terminal (not ssh'd in) having the browser pop up for the auth. And then rsync the the .clasprc.json to the remote host. It's pretty silly, but this works ¯_(ツ)_/¯

oshag-mcesc commented 1 year ago

Thanks for the work around starkprime however, my issue is I am trying to use Codespaces or gitpod so I can develop more robust Google Apps Script solutions from any Chrome browser. I am not sure how I could "rsync" the JSON file to the remote host. If you have some guidance on how to do that while using Codespace or gitod I would appreciate it (as would many others I would imagine!! )

leetutoring commented 7 months ago

I am having the same issue on my end due to the move away from OOB.

oshag-mcesc commented 7 months ago

UPDATE: I just tried this and it is not working.... not sure what do do now... if someone gets it to work please pass it along as to how you did!

I had the same issue awhile ago. So far the following is working for me on Codesandbox and Gitpod

  1. $ clasp login
  2. Opened the URL that is given in the terminal
  3. Logged in as usual
  4. Copied the [error URL] from the browser
  5. Back in Gitpod open a new terminal
  6. $ curl [error URL] <--- paste erro URL from step 4 (obviously with out the brackets) And this should successfully log you in.

Here is the reference: google/clasp#953 (comment) (should work for gitpod as well) https://github.com/google/clasp/issues/953#issuecomment-1699810044

Hope this helps!!

leetutoring commented 7 months ago

Thank you! That worked for me.