How to Run clasp login in a Docker Environment
Inside a Docker container, the authentication callback to localhost used by the standard clasp login command may not be reachable from the browser on the host. This article explains how to log in using the --no-localhost option, which does not require a local callback server.

Environment
- clasp 3.3.0
Use –no-localhost in Docker
Run the following command to log in from a Docker container:
npx clasp login --no-localhost
With --no-localhost, clasp does not start a local server for the authentication callback. Instead, you manually paste the authentication result into the terminal.
Login Steps
- Open the authentication URL displayed in the terminal in a browser on the host.
- Sign in to your Google account and grant the permissions required by clasp.
- After authentication, copy the redirect URL displayed in the browser.
- Paste the URL into the terminal where clasp is waiting, then press Enter.
After login completes, the credentials are saved to ~/.clasprc.json in the container’s home directory.
Reference
This article was generated by Cursor from a Cursor session log.