google-apps-scriptclasp

Google App script: Clasp login has stopped working


I've been using CLASP for the development of Google App Script. Clasp login command is no longer working after Clasp logout.

Steps

enter image description here

I've also tried using clasp login --no-localhost, but it gave different error:

enter image description here


Solution

  • The problem is that your browser is forcing https:// on your localhost. The way clasp login works 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:

    As for why the -no--localhost flag 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:

    enter image description here

    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 localhost method.