-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Cloud Client for new USER-scoped API tokens #1423
Merged
Merged
Conversation
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
joshmeek
reviewed
Aug 29, 2019
docs/cloud/cloud_concepts/api.md
Outdated
|
||
`TENANT`-scoped API tokens are used for long-lived programmatic access to a specific Cloud tenant. Unlike `USER` tokens, which can adopt any tenant membership the user has, `TENANT` tokens are fixed to a specific membership in a specific tenant. They adopt whatever permissions the user has in the tenant. | ||
|
||
### `AGENT` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RUNNER
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TY
3 tasks
joshmeek
approved these changes
Aug 29, 2019
cicdw
approved these changes
Aug 29, 2019
Merged
3 tasks
zanieb
added a commit
that referenced
this pull request
Apr 13, 2022
Add support for all version tags
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR supersedes #1410
Thanks for contributing to Prefect!
Please describe your work and make sure your PR:
CHANGELOG.md
(if appropriate)docs/outline.toml
for API reference docs (if appropriate)Note that your PR will not be reviewed unless all three boxes are checked.
What does this PR change?
This PR adds a new auth flow to the Python Cloud client, without changing its existing behavior. However, it does rename some private attributes.
The primary contribution of this PR is to support
USER
-scoped Cloud API tokens, which function as personal access tokens.USER
-scoped tokens can not be used to interact with the Cloud API in a significant way, but are able to authenticate with the API and receive short-lived JWTs in return. These JWTs are full auth tokens representing a user's membership in a specific Cloud tenant.The user flow works like this:
USER
-scoped API tokenclient.save_api_token()
to write the token to local storage so it persists across Python sessions.client.get_available_tenants()
to see what tenants they can login toclient.log_to_tenant(tenant_id=<>, tenant_slug=<>)
(with one or the other argument). When this happens, an ephemeral JWT is received as well as a refresh token. Note this step is also persisted across sessions.client.graphql(...)
. The Client is managing all refreshing and exchanging of JWTs in the background.client.logout_from_tenant()
. This discards the JWT access token.The
TOKEN
- andAGENT
- scoped flows are unchanged: