Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

use v4 for auth:whoami #1598

Merged
merged 1 commit into from
Jun 1, 2015
Merged

use v4 for auth:whoami #1598

merged 1 commit into from
Jun 1, 2015

Conversation

jdx
Copy link
Contributor

@jdx jdx commented Jun 1, 2015

No description provided.

jdx pushed a commit that referenced this pull request Jun 1, 2015
@jdx jdx merged commit ada478b into master Jun 1, 2015
@jdx jdx deleted the auth-whoami branch June 1, 2015 23:26
@mikehale
Copy link
Contributor

mikehale commented Jun 5, 2015

I think this is doing the wrong thing. We should not run whoami we should lookup the logged in user based on what is in ~/.netrc.

@jdx
Copy link
Contributor Author

jdx commented Jun 5, 2015

why?

@mikehale
Copy link
Contributor

mikehale commented Jun 5, 2015

That's what it used to do no?

@jdx
Copy link
Contributor Author

jdx commented Jun 5, 2015

it did, but that seems wrong to me. The login field in netrc could be anything, it wouldn't necessarily match to the HEROKU_API_KEY and it might have an expired token. This ticket mentions some of the issues with the old functionality: #1149

@mikehale
Copy link
Contributor

mikehale commented Jun 5, 2015

If I wanted to see my local machine user I'd just do echo $USER or whoami. If I want to see who I am on heroku I run heroku auth:whoami.

... just tried this locally and I'm definitely getting back my heroku user. I guess I was thinking that these were equivalent, but it seems to be doing something else which I don't understand:

Heroku::JSPlugin.run('whoami', nil, ARGV[1..-1])

and

whoami

@jdx
Copy link
Contributor Author

jdx commented Jun 5, 2015

oh so when I do Heroku::JSPlugin.run('whoami', nil, ARGV[1..-1]) what that does is call heroku whoami on the v4 cli at ~/.heroku/heroku-cli. Note that I changed this after the PR to be ~/.heroku/heroku-cli auth:whoami

@jdx
Copy link
Contributor Author

jdx commented Jun 5, 2015

but yeah, the new functionality calls /account on the api and returns the email there. This way should be better for scripting though because it's not just reading the .netrc file, it's actually checking to see if you will be able to access the API

@jdx
Copy link
Contributor Author

jdx commented Jun 5, 2015

some users were surprised that even though heroku auth:whoami returned an email that didn't mean they could actually use the API

@mikehale
Copy link
Contributor

mikehale commented Jun 8, 2015

Ah, that makes sense.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants