Repository navigation
[CP-768] feat(auth): add login with endpoint-inferred Auth0 issuer #219
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
Open
qdrant-cloud-bot
wants to merge
28
commits into
main
Choose a base branch
from
feat/oauth-auth-login
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,965
−30
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
776b4d7
feat(auth): add login with endpoint-inferred Auth0 issuer
qdrant-cloud-bot a9dfe45
docs(auth): keep public login docs production-only
qdrant-cloud-bot 79ad748
chore(deps): pin public-api to v0.203.0
qdrant-cloud-bot e4e3217
[CP-768] fix(auth): device-code audience and callback iss (#224)
qdrant-cloud-bot edf8294
[CP-768] fix(auth): listen on fixed loopback ports for the browser login
Robert-Stam a0ac15a
[CP-768] feat(auth): built-in Qdrant Cloud CLI client id per login URL
Robert-Stam 1cade25
[CP-768] feat(auth): HTML page for the browser login callback
Robert-Stam 98eadfb
[CP-768] feat(auth): callback page in the style of the Qdrant Cloud l…
Robert-Stam 9a8b076
[CP-768] fix(auth): discover says why the protected-resource metadata…
Robert-Stam a737041
[CP-768] fix(auth): request openid and email, so the token carries em…
Robert-Stam fca2122
Merge branch 'main' into feat/oauth-auth-login
Robert-Stam 7276eea
[CP-768] feat(auth): use the only granted account without --account-id
Robert-Stam d8e9241
[CP-768] feat(auth): keep auth login output to a minimum
Robert-Stam 5f984c8
[CP-768] feat(auth): show the granted scope, next to the requested one
Robert-Stam 150c58f
[CP-768] feat(auth): status shows the context and where the account c…
Robert-Stam 8d5b46a
[CP-768] feat(auth): status shows only the granted access
Robert-Stam b73b8d3
[CP-768] fix(auth): lint, blank line after the access block
Robert-Stam e38caf1
[CP-768] feat(auth): a context per granted account after login
Robert-Stam e9c8498
[CP-768] feat(context): no --oauth on context set; OAuth contexts com…
Robert-Stam a52352f
[CP-768] feat(context): context delete refuses OAuth contexts
Robert-Stam d4347c7
[CP-768] feat(auth): with several accounts, the first context becomes…
Robert-Stam d108d55
[CP-768] feat(auth): hint to log in with manage on an insufficient-sc…
Robert-Stam c699888
[CP-768] feat(auth): keep the OAuth tokens in the OS keychain
Robert-Stam 5987f16
Merge branch 'main' into feat/oauth-auth-login
Robert-Stam 2981ba3
[CP-768] chore(auth): review fixes: neutral test names, no backend na…
Robert-Stam ad06b0c
Merge branch 'main' into feat/oauth-auth-login
Robert-Stam 511416f
[CP-768] fix(auth): keep polling the device login on Auth0's authoriz…
Robert-Stam b1f5b64
[CP-768] feat(auth): print the login URL only when the browser does n…
Robert-Stam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| ## qcloud auth | ||
|
|
||
| Log in to Qdrant Cloud with a browser | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Log in to Qdrant Cloud with a browser (or a device code) instead of pasting an API key. | ||
|
|
||
| The login host is not a separate flag. It is derived from the gRPC | ||
| endpoint (flag --endpoint, env QDRANT_CLOUD_ENDPOINT, or the active context): | ||
|
|
||
| grpc.cloud.qdrant.io:443 → login.cloud.qdrant.io | ||
|
|
||
| When OAuth is enabled, the gateway also advertises the issuer at the | ||
| unauthenticated URL https://api.cloud.qdrant.io/.well-known/oauth-protected-resource. | ||
| That document wins over hostname inference. | ||
|
|
||
| After login, API calls send Authorization: Bearer <token>. Management API keys | ||
| keep working unchanged when --api-key / QDRANT_CLOUD_API_KEY is set. | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| # Discover the login URL for the current endpoint | ||
| qcloud auth discover | ||
|
|
||
| # Browser login (authorization code + PKCE on 127.0.0.1) | ||
| qcloud auth login | ||
|
|
||
| # Device code (SSH / no browser) | ||
| qcloud auth login --device --scope read-only | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for auth | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud](qcloud.md) - Qdrant Cloud CLI | ||
| * [qcloud auth discover](qcloud_auth_discover.md) - Show the OAuth login URL inferred from the API endpoint | ||
| * [qcloud auth login](qcloud_auth_login.md) - Log in with a browser or device code | ||
| * [qcloud auth logout](qcloud_auth_logout.md) - Log out and drop stored OAuth tokens | ||
| * [qcloud auth status](qcloud_auth_status.md) - Show OAuth login status for the current endpoint | ||
| * [qcloud auth token](qcloud_auth_token.md) - Print a fresh OAuth access token (sensitive) | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| ## qcloud auth discover | ||
|
|
||
| Show the OAuth login URL inferred from the API endpoint | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Print the OAuth API resource and authorization-server issuer for the current endpoint. | ||
|
|
||
| The gRPC endpoint (default grpc.cloud.qdrant.io:443) is turned into | ||
| https://api.cloud.qdrant.io. The CLI then GETs | ||
| /.well-known/oauth-protected-resource with no credentials. If the gateway | ||
| returns authorization_servers, that issuer is used; otherwise | ||
| login.cloud.qdrant.io is inferred. No client id is required. | ||
|
|
||
| ``` | ||
| qcloud auth discover [flags] | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| qcloud auth discover | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for discover | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud auth](qcloud_auth.md) - Log in to Qdrant Cloud with a browser | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| ## qcloud auth login | ||
|
|
||
| Log in with a browser or device code | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Log in and store a refreshable access token for the current endpoint. | ||
|
|
||
| The default flow is authorization code + PKCE with a loopback listener on | ||
| 127.0.0.1 (RFC 8252), on the first free port of 48271, 48272 and 48273. The | ||
| browser callback checks state and, when Auth0 sends it, iss. | ||
|
|
||
| Use --device on SSH or when no browser is available. The CLI only prints the | ||
| verification URL and polls. Sign-in and the Qdrant consent page happen in the | ||
| browser; a declined consent ends the poll with access denied. | ||
|
|
||
| The login URL comes from the gateway's unauthenticated protected-resource | ||
| metadata when OAuth is enabled, otherwise from rewriting grpc.cloud.qdrant.io | ||
| to login.cloud.qdrant.io. Override with --login-url only for debugging. | ||
|
|
||
| The Qdrant Cloud CLI client id is built in per login URL. --client-id or | ||
| QDRANT_CLOUD_OAUTH_CLIENT_ID override it, for a tenant without a built-in id. | ||
| The access and refresh tokens are stored in the OS keychain (macOS Keychain, | ||
| Windows Credential Manager, or the Secret Service on Linux); the rest of the | ||
| session is in credentials.yaml next to the config file. Without a keychain, the | ||
| tokens go to credentials.yaml (mode 0600) too. Set QDRANT_CLOUD_TOKEN_STORE to | ||
| "keychain" to require the keychain, or to "file" to skip it. | ||
|
|
||
| After the login, qcloud creates a context for every account you granted on the | ||
| consent page (named after the account, prefixed with the environment, e.g. | ||
| dev-my-account), marked as OAuth so it needs no API key. Unless you already have | ||
| a current context, the first one becomes current; switch with | ||
| "qcloud context use <name>". A later login updates | ||
| these contexts, and "qcloud auth logout" removes them. Contexts with an API key | ||
| are never changed. | ||
|
|
||
| ``` | ||
| qcloud auth login [flags] | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| # Browser login (default production endpoint) | ||
| qcloud auth login | ||
|
|
||
| # Read-only session | ||
| qcloud auth login --scope read-only | ||
|
|
||
| # Device code | ||
| qcloud auth login --device | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| --client-id string Override the built-in OAuth client id (env: QDRANT_CLOUD_OAUTH_CLIENT_ID) | ||
| --device Use the device authorization grant instead of a loopback browser flow | ||
| -h, --help help for login | ||
| --login-url string Override the login issuer URL (defaults to discovery / endpoint inference) | ||
| --scope string OAuth scope: read-only or manage (default "manage") | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud auth](qcloud_auth.md) - Log in to Qdrant Cloud with a browser | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| ## qcloud auth logout | ||
|
|
||
| Log out and drop stored OAuth tokens | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Remove the stored OAuth token for the current endpoint. | ||
|
|
||
| If the authorization server advertises a revocation endpoint, the refresh | ||
| token is revoked first. Management API keys in the config file are not | ||
| changed. | ||
|
|
||
| ``` | ||
| qcloud auth logout [flags] | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| qcloud auth logout | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for logout | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud auth](qcloud_auth.md) - Log in to Qdrant Cloud with a browser | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## qcloud auth status | ||
|
|
||
| Show OAuth login status for the current endpoint | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Show whether an OAuth session exists for the current endpoint. | ||
|
|
||
| Prints the inferred login URL, token expiry, and scope. Does not print the | ||
| access token. | ||
|
|
||
| ``` | ||
| qcloud auth status [flags] | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| qcloud auth status | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for status | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud auth](qcloud_auth.md) - Log in to Qdrant Cloud with a browser | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| ## qcloud auth token | ||
|
|
||
| Print a fresh OAuth access token (sensitive) | ||
|
|
||
| ### Synopsis | ||
|
|
||
| Print a fresh OAuth access token for the current endpoint. | ||
|
|
||
| The token is sensitive. Use this for local Terraform (auth = "cli") or scripts | ||
| that need a Bearer token. Expired access tokens are refreshed when a refresh | ||
| token is stored. | ||
|
|
||
| ``` | ||
| qcloud auth token [flags] | ||
| ``` | ||
|
|
||
| ### Examples | ||
|
|
||
| ``` | ||
| qcloud auth token | ||
| qcloud auth token --json | ||
| ``` | ||
|
|
||
| ### Options | ||
|
|
||
| ``` | ||
| -h, --help help for token | ||
| ``` | ||
|
|
||
| ### Options inherited from parent commands | ||
|
|
||
| ``` | ||
| --account-id string Qdrant Cloud Account ID (env: QDRANT_CLOUD_ACCOUNT_ID) | ||
| --api-key string Management API Key (env: QDRANT_CLOUD_API_KEY) | ||
| -c, --config string Config file path (env: QDRANT_CLOUD_CONFIG, default ~/.config/qcloud/config.yaml) | ||
| --console-url string Qdrant Cloud web console base URL (env: QDRANT_CLOUD_CONSOLE_URL, default https://cloud.qdrant.io) | ||
| --context string Override the active context (env: QDRANT_CLOUD_CONTEXT) | ||
| --debug Enable debug logging to stderr | ||
| --endpoint string gRPC API endpoint (env: QDRANT_CLOUD_ENDPOINT, default grpc.cloud.qdrant.io:443) | ||
| --json Output as JSON | ||
| ``` | ||
|
|
||
| ### SEE ALSO | ||
|
|
||
| * [qcloud auth](qcloud_auth.md) - Log in to Qdrant Cloud with a browser | ||
|
|
This file contains hidden or 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.