IP Address Mismatch on signing into Heroku CLI

HerokuHeroku Cli

Heroku Problem Overview


Previously I could sign into the heroku command line interface with heroku login. But now I get an IP address mismatch error. How should I resolve this?

Heroku Solutions


Solution 1 - Heroku

Copy and paste heroku login -i in your terminal. This is what solved it for me.

Solution 2 - Heroku

Just adding some detailed steps to resolve the issue

  1. Navigate to https://dashboard.heroku.com/account/applications
  2. In Authorizations click on create authorization button
  3. Add description in pop up eg.heroku cli and leave expire after blank if you dont want it to expire
  4. You will get authorization token
  5. in cli run heroku login -i
  6. when it prompts for password enter the authoriation token

Solution 3 - Heroku

The accepted answer (run heroku login -i) doesn't work for accounts with MFA enabled. What I did instead was to reveal my account's API key and put it into ~/.netrc like so:

machine api.heroku.com
  login <MY_EMAIL>
  password <API_KEY>
machine git.heroku.com
  login <MY_EMAIL>
  password <API_KEY>

And voila! I can now use the CLI. This worked for me with Google CloudShell.

P.S. -- I added my machine's SSH key but could not understand how to use that to configure the CLI's access. It seems hard-coded to look for API keys in ~/.netrc.

Solution 4 - Heroku

If you are using Multi-Factor Authentication you could generate an Authorization token in settings page: https://dashboard.heroku.com/account/applications

Run heroku login -i and use the generated token as password.

Solution 5 - Heroku

This error will occur when your machine is behind a proxy if you disable the proxy temporarily then authentication will be done.

Solution 6 - Heroku

For accounts that have MFA.

Run heroku login, press any key to open up browser window. Copy the url and open it in incognito mode.

Solution 7 - Heroku

New changes where added by Heroku on login. You can find the change logs here.

In case if you are behind the firewall you may need to set the proxy.

> set HTTP_PROXY=http://proxy.server.com:portnumber

Solution 8 - Heroku

If you're using a Mac running macOS 12 Monterey with the Private Relay feature enabled, you'll need to turn that off while you complete the Heroku CLI authentication workflow, since that feature is obfuscating your actual IP address by proxying your traffic through a pool of IP addresses.

Solution 9 - Heroku

Close or switch terminal, and then rerun the command "heroku login" This works for me!

Solution 10 - Heroku

I initially installed Heroku with Snap software package manager. Installing it with npm solved my problem. copy and paste the code below.

npm i -g heroku

Solution 11 - Heroku

My default browser is Safari with private relay on. This was my issue. I just copied the url from the Safari browser to one of my other browsers (Brave) and it worked.

Solution 12 - Heroku

I tried all the Solutions mentioned above but the VPN solved my issue. I think i have a problem with my ISP or HTTP PROXY

> HTTP_PROXY=http://proxy.server.com:portnumber

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChristian DoucetteView Question on Stackoverflow
Solution 1 - HerokuLex CarterView Answer on Stackoverflow
Solution 2 - HerokuMD5View Answer on Stackoverflow
Solution 3 - HerokuNeil C. ObremskiView Answer on Stackoverflow
Solution 4 - HerokuDaniel TelloView Answer on Stackoverflow
Solution 5 - HerokuM.KouchiView Answer on Stackoverflow
Solution 6 - HerokuMcConnellView Answer on Stackoverflow
Solution 7 - HerokuKJKView Answer on Stackoverflow
Solution 8 - HerokuRichard JonesView Answer on Stackoverflow
Solution 9 - HerokuJibril14View Answer on Stackoverflow
Solution 10 - HerokuPrince CharlesView Answer on Stackoverflow
Solution 11 - HerokuChad C.View Answer on Stackoverflow
Solution 12 - HerokuTakatoshi WadaView Answer on Stackoverflow