Unable to use heroku gem cli after password change

2020-05-20 05:12发布

问题:

I changed my password via the web interface. And now I can't run any command that requires authentication. Password is using plain ASCII, nothing fancy, no Unicode, weird non-printable characters, etc.

Anyone had similar experience and how you manage to resolve.

How do I even begin to go about debug this? Any verbose cli option, log I can review?

% sw_vers 
ProductName:    Mac OS X 
ProductVersion: 10.6.8 
BuildVersion:   10K549
% rvm --version
rvm 1.10.3 by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.beginrescueend.com/
% ruby --version 
ruby 1.9.3p125 (2012-02-16) [x86_64-darwin10.8.0] 
% gem --version 
1.8.17 
% heroku version 
2.25.0 
% cat ~/.netrc # is empty 
% heroku auth:login

Enter your Heroku credentials. 
Email: me@example.com
Password (typing will be hidden): 
Authentication failed.

回答1:

I had this same problem after changing the password, and I found it was because I was managing multiple accounts with the heroku-accounts gem.

I removed the account setup in heroku-accounts and then re-added it, using the new credentials to authenticate. Things then started working as before.

It seems that the authentication details stored in the heroku-accounts gem somehow override those you apply via the command line. Anyway, this worked for me.



回答2:

You can also try this:

$ heroku accounts:remove your_app

followed immediately by

$ heroku accounts:add your_app

Enter your email and your new password, and you should be good to go.



回答3:

The problem is due to heroku accounts as detailed by @vaughanos in his answer. A quick way to fix this is.

Check the accounts you have

heroku accounts

account1

*account2

The * indicates the heroku account being used for the current project. This is the account you have done the password change for using the web interface.

Change the default account you have setup for this project

Either change it in .git/config or do a heroku accounts:set account1

Now do heroku accounts:remove account2

Now add it back with heroku accounts:add account2. Enter your email and new password. Everything will be setup up for you.

If it prompts you to update your ~/.ssh/config, do it, but most likely that wouldn't require a change.



回答4:

For all the future error-Googlers out there:

The issue from 2013 has been fixed, however, after you change your password on the website, use the command:

heroku login

You will be prompted for your Heroku login and your new password. Goodbye weird "Authentication success. Authentication failure." errors.

via the Heroku docs: https://devcenter.heroku.com/articles/authentication, about half-way down the page.



回答5:

I had the same issue on Windows Vista.

I got authorization failed messages on every heroku command and wasn’t able to login.

c:\Sites\jut>heroku login
 !    Heroku client internal error.
 !    Search for help at: https://help.heroku.com
 !    Or report a bug at: https://github.com/heroku/heroku/issues/new

    Error:       Permission denied - C:/Users/myusername/_netrc (Errno::EACCES)
    Backtrace:   C:/Program Files/Heroku/vendor/gems/netrc-0.7.7/lib/netrc.rb:179:in `initialize'
                 C:/Program Files/Heroku/vendor/gems/netrc-0.7.7/lib/netrc.rb:179:in `open'
                 C:/Program Files/Heroku/vendor/gems/netrc-0.7.7/lib/netrc.rb:179:in `save'
                 C:/Program Files/Heroku/lib/heroku/auth.rb:94:in `delete_credentials'
                 C:/Program Files/Heroku/lib/heroku/auth.rb:40:in `login'
                 C:/Program Files/Heroku/lib/heroku/command/auth.rb:31:in `login'
                 C:/Program Files/Heroku/lib/heroku/command.rb:206:in `run'
                 C:/Program Files/Heroku/lib/heroku/cli.rb:28:in `start'
                 C:/Program Files/Heroku/bin/heroku:24:in `<main>'

    Command:     heroku login
    Version:     heroku/toolbelt/2.33.2 (i386-mingw32) ruby/1.9.2

I deleted C:/Users/myusername/_netrc where the passwords are stored.

After that I was able to heroku login again and all went fine!



回答6:

For me, following all the instructions on this page and uninstalling/reinstalling heroku toolbelt from their website did the trick.