Support Forums

Unable to connect to my netlify account via cli

Netlify init doesn’t login me into my account from the CLI. It redirects me to a page where the logo keeps spinning

Hi, @gfellah, this is because the Netlify CLI tool is trying to get an authorization token via the login session for our site in the browser. It only works if you are already logged into the Netlify web app (at https://app.netlify.com/).

To resolve this, first please login to the website. Then run the two following commands in the shell:

netlify logout
netlify login

If that doesn’t resolve the issue, please let us know.

I tried logging out and then logging in from the cmd but I cannot login. It just gets stuck at the spinner in the browser. I tried using different browsers but it does not help.

Hi, @faraznisar, I don’t see any issues with your account or user login.

Please check the following:

  • confirm you are logged into the Netlify web app (https://app.netlify.com/)
  • disable any/all browser extensions
  • clear the local browser cache

After doing all three things above, then try the logout/login with Netlify CLI again:

netlify logout
netlify login

If you still cannot login with Netlify CLI after doing this, please let us know.

on my case the problem still persisted
FetchError: request to https://api.netlify.com/api/v1/oauth/tickets/4d860f39b94734e2c3be7b5a4e3179de failed, reason: getaddrinfo ENOTFOUND api.netlify.com at ClientRequest.<anonymous> (/usr/local/lib/node_modules/netlify-cli/node_modules/node-fetch/lib/index.js:1455:11)

sorry to hear that, @code-ninja-james ! could you please file an issue here so we can take a look: