IP Address Mismatch on signing into Heroku CLI
HerokuHeroku CliHeroku 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
- Navigate to https://dashboard.heroku.com/account/applications
- In Authorizations click on create authorization button
- Add description in pop up eg.heroku cli and leave expire after blank if you dont want it to expire
- You will get authorization token
- in cli run heroku login -i
- 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