Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

wrangler whoami cannot print out email for users using API tokens #863

Closed
gabbifish opened this issue Nov 11, 2019 · 1 comment · Fixed by #1212
Closed

wrangler whoami cannot print out email for users using API tokens #863

gabbifish opened this issue Nov 11, 2019 · 1 comment · Fixed by #1212
Assignees
Labels
Milestone

Comments

@gabbifish
Copy link
Contributor

gabbifish commented Nov 11, 2019

Because the /user Cloudflare v4 API endpoint doesn't support API tokens yet, we can't retrieve a user's email using their API token. This means wrangler whoami won't be able to provide the expected email output for API token users (an error message informing users of this is currently printed out).

@gabbifish gabbifish added this to the 1.6.0 milestone Nov 11, 2019
@EverlastingBugstopper EverlastingBugstopper modified the milestones: 1.6.0, 1.7.0 Nov 15, 2019
@ashleygwilliams ashleygwilliams modified the milestones: 1.7.0, 1.6.0 Nov 18, 2019
@ashleygwilliams ashleygwilliams self-assigned this Nov 18, 2019
@EverlastingBugstopper EverlastingBugstopper modified the milestones: 1.6.0, 1.7.0 Nov 21, 2019
@EverlastingBugstopper EverlastingBugstopper removed this from the 1.7.0 milestone Dec 9, 2019
@dhaynespls dhaynespls self-assigned this Mar 27, 2020
@dhaynespls
Copy link
Contributor

The new default cloudflare workers API token template includes the required permission in order to do this lookup:
image

I'm thinking the output including your email should look something like the following to mirror the output of using the global API token:

⌘ ~> wrangler whoami

👋  You are logged in with an API Token, associated with the email 'dhaynes@cloudflare.com'.

+------------------------------------------+----------------------------------+
| Account Name                             | Account ID                       |
+------------------------------------------+----------------------------------+
| My Security Team Testing Account | ... accountID ... |
+------------------------------------------+----------------------------------+

I'll work on a PR for this!

dhaynespls added a commit that referenced this issue Apr 16, 2020
- query the same api endpoint as we do with the global token, but now with the api token
- return errors, print helpful statement if the api token doesn't have the right permission

Closes #863
@EverlastingBugstopper EverlastingBugstopper added this to the 1.9.0 milestone May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants