I've been using CLASP for the development of Google App Script. Clasp login command is no longer working after Clasp logout.
Steps
- Execute Clasp login in VS Code Terminal. It redirects to the Google OAuth page.
- Entered credentials and accepted the required permissions for Clasp in the browser
- After successful authentication, it redirects to some localhost:port and then it gets stuck with this error
I've also tried using clasp login --no-localhost, but it gave different error:


The problem is that your browser is forcing
https://on yourlocalhost. The wayclasp loginworks is that it creates a temporary local server to receive the authorization code from Google in the OAuth flow. This server won't have an SSL certificate so forcing an https connection will return that error. Your potential solutions are:https://tohttp://, though if it's not working already it probably means that something is forcing it.edge://net-internals/#hsts(orchrome://net-internals/#hstson Chrome) then addlocalhostunder "Delete domain security policies" and click "Delete".localhostas an exception..clasprc.jsonfile from the other %USERPROFILE% folder to your current one. The credentials will be associated with the Google account that you used to sign in.As for why the
-no--localhostflag doesn't work, this is because the Out-Of-Band flow has been deprecated. You can see this in the full description of the error:This means that the "enter a code" flow is no longer supported and Google has blocked it. It's up to the devs to update the Clasp app to remove the flow or to implement a workaround. You can try to report it in their Github page. As far as I can tell there's not much that can be done about this setting and you most likely will need to go with the
localhostmethod.