heroku-accounts icon indicating copy to clipboard operation
heroku-accounts copied to clipboard

2FA not working

Open sobrinho opened this issue 4 years ago • 14 comments
trafficstars

$ heroku accounts:add personal
Enter your Heroku credentials:
Email: [redacted]
Password: [redacted]
 ▸    Multi-Factor Authentication is required for your account. Please remove the '--interactive' parameter and try again to login and complete MFA verification using a web
 ▸    browser.

sobrinho avatar Feb 14 '21 13:02 sobrinho

Any updates on this? Having the same issue

cvrsor avatar Mar 11 '21 10:03 cvrsor

Having this issue too. I'm getting a slightly different message though:

% heroku accounts:add personal
Enter your Heroku credentials:
Email: [redacted]
Password: [redacted]
 ▸    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.

Rileyc2022 avatar Apr 15 '21 02:04 Rileyc2022

Same error message here

rubengmurray avatar May 01 '21 18:05 rubengmurray

As a workaround, I did this to manually create an account (using Ubuntu):

$ mkdir -p ~/.heroku/accounts
$ echo "username: [email protected]\npassword: " > ~/.heroku/accounts/YOUR_ACCOUNT

Now when you try to execute a command with this account, Heroku recognizes the creds are bad and sends you to the browser login to get a token instead of asking for your password:

$ heroku accounts:set YOUR_ACCOUNT
$ heroku create
Creating app... !
 ▸    Invalid credentials provided.
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to [redacted]
Logging in... done
Logged in as [email protected]
Creating app... done,

abevoelker avatar May 07 '21 03:05 abevoelker

This workaround doesn't allow you to switch easily. You have to sign in again each time.

I'm going to fork this project and submit a PR to support getting and setting the api token properly through the web auth flow.

justindonnaruma avatar Jul 14 '21 12:07 justindonnaruma

https://github.com/heroku/heroku-accounts/issues/35#issuecomment-820019138

Note that an API key can be used as password as well.

Source: https://stackoverflow.com/questions/68105084/not-able-login-to-heroku-account-from-command-line

holtkamp avatar Oct 30 '21 14:10 holtkamp

https://github.com/heroku/heroku-accounts/pull/38

rubengmurray avatar Dec 19 '21 13:12 rubengmurray

@rubengmurray doesn't work for actual personal accounts with 2FA.

sobrinho avatar Dec 20 '21 14:12 sobrinho

Really? I did the following:

  • heroku accounts:add my_name
  • prompted for email
  • prompted for password (used API key)

Worked.

I'm just using a standard personal login, go to top right, account settings, then bottom of the screen, API key...

rubengmurray avatar Dec 20 '21 18:12 rubengmurray

Using API key as password worked for me as well 😄 Thanks @holtkamp

bruno-uy avatar Dec 27 '21 02:12 bruno-uy

Needs instructions in the README for how to do this. I don't really follow the discussion in this thread.

Seeing as how heroku now requires MFA, and this tool does not work as documented with an account with MFA... I'm getting the feeling heroku doesn't actually support this tool anymore? (I'm getting the feeling it's unclear what heroku does support anymore?)

jrochkind avatar May 11 '22 15:05 jrochkind

@jrochkind - the fact I raised this in Dec last year and it's had 0 comments would support that theory, though I'm still using this fine with multiple accounts locally.

Is the generating of an API key to use as a substitute for your password the element that is unclear?

rubengmurray avatar May 11 '22 17:05 rubengmurray

The state of this repository is so bad that even it's from heorku, I feel insecure (Pun intended)

divineslight avatar Oct 09 '23 11:10 divineslight

@jrochkind I wrote a few words at https://github.com/heroku/heroku-accounts/issues/19#issuecomment-1991785520 how I use this plugin

dentarg avatar Mar 12 '24 14:03 dentarg