How do I identify the username for my heroku token? - heroku

I have a terminal that's logged in to Heroku, but I'm not entirely sure under which userid. How do I check if it's me (as opposed to my coworker), so as to not clobber someone else's heroku app?

$> heroku auth:whoami
will show you who you are currently authenticated as.

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

Heroku login - There was a problem with your login

I am trying to login into my heroku account but that fails with There was a problem with your login.
I have already reset my password and tried logging in from four different browsers on three different machines, to no avail.
I would raise a ticket at the heroku helpdesk but that is not possible without login. Any idea how to proceed on this? I haven't found a traditional hotline to call either...
Heroku experienced a major security incident last month and further determined that an "attack agent" exfiltrated hashed passwords. Because of this incident, Heroku reset all user passwords on May 4.
From the incident page:
Salesforce is ensuring all Heroku user passwords are reset and potentially affected credentials are refreshed. We have rotated internal Heroku credentials and put additional detections in place.
For now, a password reset to something other than your last password is not a bad idea.
Resetting my password worked for me

IP Address Mismatch when trying to access Heroku CLI

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.

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.

Lost Heroku password, original email no longer exists to retrieve reset

I have lost my login password to my Heroku app. Also, the original email I signed up with no longer exists so I can't retrieve a reset email.
Can anyone suggest how I can get access to my account from the Heroku web site under these circumstances?
Thanks in advance.
If your Heroku CLI is still working against the old email I would suggest setting up a new Heroku account with a new email address. Add your new account as a collaborator via heroku sharing:add <newemail> and then transfer the app to the new email using heroku sharing:transfer <newemail>.
When you've transferred all your apps to the new email use heroku auth:logout and then heroku auth:login and use your new credentials.

Resources