feat(opencode): add Snowflake Cortex SSO (external browser) authentication#31703
Closed
davidfierro wants to merge 1 commit into
Closed
feat(opencode): add Snowflake Cortex SSO (external browser) authentication#31703davidfierro wants to merge 1 commit into
davidfierro wants to merge 1 commit into
Conversation
…ation Add SSO via the Snowflake external-browser flow alongside the existing PAT auth. Replicates the driver handshake (authenticator-request -> loopback -> login-request), sends the session token with the `Snowflake Token` header the Cortex REST API accepts, and renews it automatically. Selectable from both `auth login` and the TUI `/connect` dialog; PAT auth is unchanged.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Found a potential duplicate: PR #31700 - This PR appears to address the same feature: adding external browser OAuth/SSO authentication for Snowflake Cortex. It likely implements the same EXTERNALBROWSER handshake flow and IdP token capture mechanism that PR #31703 adds. |
Author
|
Closing the PR as it's duplicated with #31700 |
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
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.
Issue for this PR
Closes #31702
Type of change
What does this PR do?
Snowflake Cortex previously only supported PAT auth. This adds SSO via the external browser flow, so users on accounts with an external IdP can log in without a token.
It replicates the Snowflake driver EXTERNALBROWSER handshake: POST
/session/authenticator-request→ open the browser → capture the IdP token on a local 127.0.0.1 loopback → POST/session/v1/login-requestto get a session + master token. The custom fetch sendsAuthorization: Snowflake Token="<session>"(the format the Cortex REST API actually accepts —Beareris rejected, verified against a live account) and transparently renews the session token via/session/token-requestwhen it nears expiry. When the master token expires the user is asked to log in again.SSO is selectable from both
opencode auth login(PAT | SSO) and the TUI/connectdialog. PAT auth is unchanged.How did you verify your code works?
packages/opencodeandpackages/core):snowflake-sessioncredentialSnowflake Tokenheader injection, single-flight renewal under concurrent requests, and the master-token-expired error path/connectplugin exposes PAT + SSO methods and persists asnowflake-sessioncredential identical to the CLI pathbun dev,/connect→ Snowflake Cortex → SSO, completed the IdP login in the browser, confirmed the model picker lists the Cortex models and a chat request streams successfully; confirmed PAT login still works.Screenshots / recordings
TUI change —
/connectnow shows a PAT/SSO method selector for Snowflake Cortex. Happy to attach a recording if useful.Checklist