-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: better error when not enough scopes for SSO login (#9948)
### Description When you already have a token but don't have SSO scopes, we were throwing an error that didn't have much information. The error should be more clear now when you are in this state, informing you to use `--force`. Specifically you could get into this state by doing: ``` turbo login turbo login --sso-team=my-team ``` #### Note I happy-pathed (error-pathed?) this for the specific case I wanted to solve for. I'm not sure if this is accidentally changing the error for other problematic states you can be in. ### Testing Instructions I'm struggling to write a unit test. Help would be appreciate if you think one would be good for this (I do). Additionally, here's a before and after: Before: ``` ▲ 👟 turbo on shew/6b0e1 turbo login turbo 2.4.0 >>> Opening browser to https://vercel.com/turborepo/token?redirect_uri=redacted >>> Success! Turborepo CLI authorized for [email protected] To connect to your Remote Cache, run the following in any turborepo: npx turbo link ▲ 👟 turbo on shew/6b0e1 took 6s turbo login --sso-team=my-team turbo 2.4.0 × Error making HTTP request: HTTP status client error (403 Forbidden) for url (https://vercel.com/api/v2/teams/my-team) ╰─▶ HTTP status client error (403 Forbidden) for url (https://vercel.com/api/v2/teams/my-team) ``` After: ``` ▲ 👟 turbo on shew/6b0e1 dt login turbo 2.4.2-canary.0 >>> Opening browser to https://vercel.com/turborepo/token?redirect_uri=redacted >>> Success! Turborepo CLI authorized for [email protected] To connect to your Remote Cache, run the following in any turborepo: npx turbo link ▲ 👟 turbo on shew/6b0e1 took 2s dt login --sso-team=my-team turbo 2.4.2-canary.0 × [HTTP 403] request to https://vercel.com/api/v2/teams/my-team returned "HTTP status client error (403 Forbidden) for url (https://vercel.com/api/v2/teams/my-team)" │ Try logging in again, or force a refresh of your token (turbo login --sso-team=your-team --force). ``` --------- Co-authored-by: Chris Olszewski <[email protected]>
- Loading branch information
1 parent
8e8c6b7
commit 80a6f65
Showing
3 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters