Authentication failure in Heroku CLI after password change
Asked Answered
C

6

13

After a password change on heroku's website, I can't access the heroku api.

When I do heroku login, I get Authentication successful, even though it shouldn't because the password has changed. It doesn't even ask for my email or password, like it should!

If I try heroku apps (or any other application related command), I get Authentication failure.

If I try heroku status, it works.

I don't have any plugins installed.

Logs:

$ heroku version
heroku-gem/3.6.0 (i686-linux) ruby/2.1.0
$ heroku logout
Local credentials cleared.
$ heroku login
Authentication successful.
$ heroku apps
Authentication failure
$ heroku plugins
You have no installed plugins.

I'll appreciate any help or ideas I can get. I already opened a ticket and waiting for the Heroku Support to get back to me.

Thanks

Confection answered 9/4, 2014 at 9:3 Comment(0)
C
13

Apparently, changing the password for heroku regenerates a new API key, and I had the wrong HEROKU_API_KEY configured. (It regenerates a new one after password change).

I'm posting here the response from the great Heroku's support team, which gave me these suggestions:

  • Is there a ~/.netrc file on your computer? If there is, can you please check if the file contains something Heroku related things? Please remove if there is, and try login again.
  • Is there an HEROKU_API_KEY environment variable defined on your machine? If yes, could you remove it and login try again?
  • Is there a ~/.heroku/credentials file (with or without an extension) on your machine? If yes, could you remove it and try login again?
  • Finally, if none of those work, could try the following command: GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' heroku login and see how it goes?
Confection answered 9/4, 2014 at 9:31 Comment(3)
++! After reading a lot of stuff about heroku accounts (which doesn't exist anymore, and the replacement asks for credentials creating a catch-22) and trying other things that did not help, the GEM commandline did the trick.Arrington
Why in the hell it creates those is beyond me.Saddler
Why in the hell it needs those is beyond me. Logging in first time? Files obviously either don't exist or aren't configured to an account. Logging in is no problem. Change password after that? Now the server disagrees with your authentication files, so entering the old or new password doesn't work. AND my account isn't any more secure as a result. The files don't even save me time, because I still need to enter my password anyway.Saddler
U
17

After a password change on heroku's website, I can't access the heroku api.

Are you using the heroku-accounts plugin? If so, try uninstalling it.

heroku plugins:uninstall heroku-accounts
rm -r ~/.heroku/accounts
heroku logout
heroku login
Unfinished answered 14/4, 2014 at 14:31 Comment(1)
You may not have to... #22958164Brilliancy
C
13

Apparently, changing the password for heroku regenerates a new API key, and I had the wrong HEROKU_API_KEY configured. (It regenerates a new one after password change).

I'm posting here the response from the great Heroku's support team, which gave me these suggestions:

  • Is there a ~/.netrc file on your computer? If there is, can you please check if the file contains something Heroku related things? Please remove if there is, and try login again.
  • Is there an HEROKU_API_KEY environment variable defined on your machine? If yes, could you remove it and login try again?
  • Is there a ~/.heroku/credentials file (with or without an extension) on your machine? If yes, could you remove it and try login again?
  • Finally, if none of those work, could try the following command: GEM_HOME='' BUNDLE_GEMFILE='' GEM_PATH='' RUBYOPT='' heroku login and see how it goes?
Confection answered 9/4, 2014 at 9:31 Comment(3)
++! After reading a lot of stuff about heroku accounts (which doesn't exist anymore, and the replacement asks for credentials creating a catch-22) and trying other things that did not help, the GEM commandline did the trick.Arrington
Why in the hell it creates those is beyond me.Saddler
Why in the hell it needs those is beyond me. Logging in first time? Files obviously either don't exist or aren't configured to an account. Logging in is no problem. Change password after that? Now the server disagrees with your authentication files, so entering the old or new password doesn't work. AND my account isn't any more secure as a result. The files don't even save me time, because I still need to enter my password anyway.Saddler
B
6

Are you using the heroku-accounts plugin? If so, try uninstalling it.

You may not need to uninstall it...

Make sure you are not in a project directory (or you may run into the "account not found" loop).

cd

List your accounts.

heroku accounts

On each account where the password was changed

heroku accounts:remove ACCOUNT
heroku accounts:add ACCOUNT

(I did not need to do anything with the ~/.ssh/config.)

Reset your default account, if needed.

heroku accounts:default ACCOUNT

If you changed the account name or git config --unset heroku.account.

cd /path/to/your/project
git config --add heroku.account ACCOUNT

I didn't want to give up on the heroku-accounts plugin. :)

Brilliancy answered 1/5, 2014 at 19:0 Comment(0)
P
3

heroku accounts:remove personal or whatever account name you have

git config --unset heroku.account

heroku accounts:add personal then login

Poteat answered 11/11, 2014 at 4:0 Comment(0)
L
2

In my case, I had multiple heroku accounts managed by heroku-accounts gem and authentication started failing after I changed one of my account's password.

Steps I followed to make things normal again:

  1. Removed the account (that's failing to authenticate) from heroku accounts:

    heroku accounts:remove account_name

  2. Opened up a new terminal and then added the account again that I just deleted:

    heroku accounts:add account_name --auto

Here you have to use your new credentials.

That's it. Problem solved.

Lovins answered 19/6, 2014 at 16:15 Comment(0)
G
0

Try deleting ~/.netrc (this is where the Heroku CLI tool saves the auth tokens) and starting over.

Gschu answered 9/4, 2014 at 9:23 Comment(3)
Nope, haven't got a ~/.netrc file.Confection
That's odd. heroku login is successful with the right user/pass?Gschu
it didn't even ask for email/pass, just wrote Authentication successful. The problem was already solved, I had an environment variable HEROKU_API_KEY defined, and after I changed the password, Heroku automatically regenerates it.Confection

© 2022 - 2024 — McMap. All rights reserved.