🐛 BUG: Wrangler fails token authorization when ID is not provided
See original GitHub issueWhat version of Wrangler
are you using?
2.0.29 - 2.1.4
What operating system are you using?
Windows and Linux
Describe the Bug
Create a new token for with the following permissions:
User > User Details > Read Account > Account Settings > Read Account > Cloudflare Pages > Edit
Now run CLOUDFLARE_API_TOKEN=<token> wrangler pages publish <folder> --project-name <project>
You will see an error:
Failed to automatically retrieve account IDs for the logged in user.
You may have incorrect permissions on your API token. You can skip this account check by adding an account_id in your wrangler.toml, or by setting the value of CLOUDFLARE_ACCOUNT_ID.
Since my token is associated with a single account, wrangler should not ask for CLOUDFLARE_ACCOUNT_ID
to log me in.
This is in part a security issue, as a compromised token can be invalidated but a compromised account ID cannot!
Issue Analytics
- State:
- Created a year ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Primary Refresh Token (PRT) and Azure AD - Microsoft Learn
The device ID claim is used to determine authorization for Conditional Access based on device state or compliance. Session key: The session key ......
Read more >Deprecations · Cloudflare Workers docs
The wrangler config command is no longer available for authenticating via an API token. Use wrangler login / wrangler logout to manage OAuth ......
Read more >Tokens & Authentication - React chat - GetStream.io
Stream uses JWT (JSON Web Tokens) to authenticate chat users, enabling them to login. Knowing whether a user is authorized to perform certain...
Read more >JWT Auth – WordPress JSON Web Token Authentication
WordPress JSON Web Token Authentication allows you to do REST API authentication via token. It is a simple, non-complex, and easy to use....
Read more >Kong JWT Signer plugin
The plugin refers to tokens as an access token and channel token. ... When authentication or authorization fails, or there is an unexpected...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, that should fix the issue. And CI/CD docs section got an update with a very clear explanation 🎉
I’ve opened a PR internally to update the “Edit Cloudflare Workers” template to include the “User Memberships: Read” permission, and opened https://github.com/cloudflare/cloudflare-docs/pull/6273 to update the docs once the internal PR is merged. It seems to me like once those go live that should be enough to solve this problem, or am I misunderstanding?