IP Address Mismatch when trying to access Heroku CLI - heroku

It is my first app that I am deploying to heroku but I am stuck on this error and do not know how to go about it. I've tried heroku login-i , this doesn't work for me because I have MFA activated.

I see your command is correct, but your syntax is incorrect. heroku login -i is the proper syntax. Between the login and -i, there should be a space between them. I have attached a screenshot with that as well. If you still encounter issues, please let me know.

Try the following step to resolve the IP mismatch issue:
Navigate to https://dashboard.heroku.com/account/applications
Click on create authorization button in the Authorizations tab.
Add a description and leave expire as blank.
Copy the Authorization token.
Open terminal/heroku cli, run heroku login -i
Enter the mail id and provide authoriation token as password.

Related

when i am trying to login Heroku there is an message IP Address Mismatch [duplicate]

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?
Copy and paste heroku login -i in your terminal. This is what solved it for me.
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
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.
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.
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.
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.
This error will occur when your machine is behind a proxy if you disable the proxy temporarily then authentication will be done.
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
If you are a Mac user on 12.3 or later, you need to open System Preferences, > Network > Wi-Fi, and then uncheck "Limit IP Address Tracking" for the duration of your authentication.
New OSX masks your IP address, and Heroku login doesn't know how to deal with it. All you need is to let Heroku verify IP before/after auth, and you'll be good to go.
for me heroku login -i worked..
didnt need the token.after heroku login -i it wanted my credentials...i.e email and password and i was logged in
If you're using Multi Factor Authentication you have to create an API key. To do that:
Go here: https://dashboard.heroku.com/account (login if asked)
Click here:
Open the hidden file located at ~/.netrc and paste your API key in the two 'password' fields.
For example, if your API key is 'a8g73nga-9vb2-0184-afbc-54fac2b66c75', then it should look like this:
machine api.heroku.com
login your.email#example.com
password a8g73nga-9vb2-0184-afbc-54fac2b66c75
machine git.heroku.com
login your.email#example.com
password a8g73nga-9vb2-0184-afbc-54fac2b66c75
The heroku CLI will now work!
Reference
Heroku CLI Authentication docs
This worked for me:
1/ Logout in the browser
2/ Clear cache and cookies for heroku.com (optional)
3/ Run "heroku login"
4/ Logging in the browser tab opened by the CLI
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
Close or switch terminal, and then rerun the command "heroku login" This works for me!
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.
I was able to connect with the following:
heroku login -I //
email: user#email.com //
password: api key # from account settings
So satisfying!
For some reason heroku login -i led to some I/O issues on Google Colab for me.
I needed to press the return key multiple times after entering the password, and that somehow made the credentials incorrect.
I had to open up a Colab Terminal to login as I would via any Linux-based shell (The Colab terminal is available on Colab Pro and Pro+).
I had the same issue. I used heroku login. It worked.
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

How to create an authorization token for remote login for heroku?

I am trying to access logs from an app. Apparently, the only way to do that is the herkoku client.
I am working remotely. When I do
heroku login -i
Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please generate an authorization token for API access.
But there is no link provided where or how to get such a token.
And the documentation does not mention the creation of such a token. Only how to store it.
Any ideas?
While logged in to the Heroku web interface, go to "Account settings" (in the menu under your avatar in the top right) and scroll down to "API Key". Generate one if there isn't one already, or click "Reveal" to see the existing one.
Now, re-run heroku login -i, and enter your email as normal, but enter that API key instead of your account password.
The above method works. But: You have to type this password into the CLI. Cutting and pasting does not work.

Heroku Login Multi-Factor Authentication mfa_required error (without opening a browser)

When using Heroku Multi-Factor Authentication, is there any way to login via the console without opening the browser?
ubuntu:~/environment $ heroku login -i
heroku: Enter your login credentials
Email [hello#gmail.com]:
Password: ****************
› Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please
› generate an authorization token for API access.
›
› Error ID: mfa_required
Yes. Basically, to set this up what you want to do is:
Login to Heroku and create an API Token under "Account settings". (You said "without opening a browser", and I'm assuming you mean 'How to authenticate from the command-line'. To set this up you will need to open a browser ... once ;)
In your local machine's home directory, check to see if you already have a file called .netrc. If not, simply create one like so -- touch ~/.netrc.
From there you'll want to append the following to that file (and save):
machine api.heroku.com
login <your-email-goes-here>
password <the-api-token-goes-here>
machine git.heroku.com
login <your-email-goes-here>
password <the-api-token-goes-here>
If you just created the .netrc file you'll want to chmod 600 .netrc to give it necessary permissions.
At this point, you can try the command heroku auth:whoami and hopefully see your user e-mail printed back to you.
FWIW, Heroku does have some docs covering this here, but to be honest, the docs are rather disjointed and I would think unhelpful to someone that's never done something like this before, which is why I tried to go step-by-step.
I hope this is what you wanted and / or someone finds this helpful :)
For multi-factor authentication enabled heroku account, If you can get the API key then there is a simpler way to sign in via CLI. type -> heroku login -i
enter the email id associated with your heroku account and for password you must enter the API key that you got from the account settings page.

How to Create OAuth Client ID?

I am trying to run this github project.
For this I need to create credentials and OAuth Client Id.
When I click to create. After selecting web applications and typing the name I see authorised javascript and authorised redirect uri.
So what should I enter there because I tried with keeping both fields empty. But I got error saying no redirect url found for client id
Please help me.
I am using Developer Console for first time can't find any help on internet. This site is my last hope.
I did as said in [comment].2
Here is what I got in Linux shell and the error i received on redirected url opened webpage.
Linux Shell Message
/YouTube-Subscription-Importer/env/lib/python3.6/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access subscribe.py-oauth2.json: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Your browser has been opened to visit:
https://accounts.google.com/o/oauth2/auth?client_id=1069660256195-n8adm0dmi70v29i55hcfblftle09hb5n.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&access_type=offline&response_type=code
If your browser is on a different machine then exit and re-run this
application with the command-line parameter
--noauth_local_webserver
Snipe of what redirect url webpage said
**MOST IMPORTANT
I am running this in windows bash.
Now tell me what to do next.
I just simply need a tutorial/how-to use guide for Google developer console credentials and OAuth Screen.
**
You need the redirect URL, you will be redirected from Google OAuth Consent Screen to https://REDIRECT_URL?code=AuthorizationCode, you can just set it to http://localhost.
After creation, you can your find Client ID on the Credentials page.

"Failed to load owners" error in Xcode using GitHub

I am just starting out trying to connect Xcode to Github. I keep getting this peculiar error, saying "Failed to load owners" whenever I try to create a remote repository from within Xcode under the Source Control Manager. See the error here
If I ignore the warning, the upload then fails with this error.
I cannot seem to find anything online regarding this, and I cannot for the world notice anything being wrong with my GitHub account. The account itself is also accepted by Xcode (successfully added under the Accounts pane in Preferences).
Any help will be greatly appreciated.
In your GitHub account, when you are creating a personal access token to connect your Xcode to GitHub, you have to check off repo, write:packages, and read:packages.
Shown by the image here: https://i.stack.imgur.com/NUiiC.png
Then, you should be able to create the repo without any problems! Hope this helped.
I deleted my GitHub-Profile in the XCode Preferences and setted up again. After that it worked smoothly.
After having had a chat with a kind representative from GitHub Developer Support, it seems like it in my case had to do with my old username and password credentials that was saved on my machine. I quote:
Sometimes applications can use these old credentials, even if you
replace it with the personal access token.
Credentials for git authentication are stored in the Keychain App, and
git passes these onto GitHub when pushing changes to a Repository.
I'd suggest checking in the Keychain App for any records with the name
GitHub.
If they exist, delete those and try the push again.
Git should ask you to enter your username and password and once you
re-enter them, the correct credentials should be stored in your
Keychain app for future use.
So there you have it. This in fact solved my problem. It could also have had something to do with the personal access token that might not be set up with the proper permissions. If you have the same problem as I had you could also check out the scopes on your personal access token to verify it has access to everything you need. Step 7 on the help guide below has a screenshot of what that looks like:
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
For anyone who's looking for another way. What happened to me is that my personal access token expired, and I needed to generate a new one in Github / setting/ developer/ access token. After I generated a new one, I logged out of Github via Xcode, Logged back in and put in my new access code and cleared the issue!

Resources