Remove token scope checks #566
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removal of token scope checks
This PR removes token scope checks, as the API itself returns reasoning when a token without a valid scope is used, removing an additional API call made in
PreRunEto check token scopes in favour of trusting the API.Additionally, this reduces complexity with caching of token scopes, as this is no longer a required check.
We also cut API calls in half for affected commands (build cancel/new/list, job cancel/list, etc.), which addresses rate limiting concerns.
Example error messages users will see:
Example (403, token not scoped):
Example (401, invalid token):
Slight rework to the config check
Due to the changes, I've reworked the way that we prompt for missing config/env vars, as this check was being used to determine it.
As such, if you have no token/org slug, you'll get this:
If you have a token set, but no org slug:
If you have an org slug set, but no API token: