Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add OAuth 2.1 authentication support#693

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
EhabY wants to merge9 commits intocoder:main
base:main
Choose a base branch
Loading
fromEhabY:oauth-support

Conversation

@EhabY
Copy link
Collaborator

@EhabYEhabY commentedDec 16, 2025
edited
Loading

Implements OAuth 2.1 with PKCE as an alternative authentication method to session tokens. When connecting to a Coder deployment that supports OAuth, users can choose between OAuth and legacy token authentication.

Key changes:

OAuth Flow:

  • Add OAuthSessionManager to handle the complete OAuth lifecycle: dynamic client registration, PKCE authorization flow, token exchange, automatic refresh, and revocation
  • Add OAuthMetadataClient to discover and validate OAuth server metadata from the well-known endpoint, ensuring server meets OAuth 2.1 requirements
  • Handle OAuth callbacks via vscode:// URI handler with cross-window support for when callback arrives in a different VS Code window

Token Management:

  • Store OAuth tokens (access, refresh, expiry) per-deployment in secrets
  • Store dynamic client registrations per-deployment in secrets
  • Proactive token refresh when approaching expiry (viaresponse interceptor timers)
  • Reactive token refresh on 401 responses with automatic request retry
  • Handle OAuth errors (invalid_grant, invalid_client) by prompting for re-authentication

Integration:

  • Add auth method selection prompt when server supports OAuth
  • Attach OAuth interceptors to CoderApi for automatic token refresh (+ detach when no longer using OAuth)
  • Clear OAuth state when user explicitly chooses token auth
  • DeploymentManager coordinates OAuth session state with deployment changes

Error Handling:

  • Typed OAuth error classes (InvalidGrantError, InvalidClientError, etc.)
  • Parse OAuth error responses from token endpoint
  • Show re-authentication modal for errors requiring user action

Implements OAuth 2.1 with PKCE as an alternative authentication methodto session tokens. When connecting to a Coder deployment that supportsOAuth, users can choose between OAuth and legacy token authentication.Key changes:OAuth Flow:- Add OAuthSessionManager to handle the complete OAuth lifecycle: dynamic  client registration, PKCE authorization flow, token exchange, automatic  refresh, and revocation- Add OAuthMetadataClient to discover and validate OAuth server metadata  from the well-known endpoint, ensuring server meets OAuth 2.1 requirements- Handle OAuth callbacks via vscode:// URI handler with cross-window  support for when callback arrives in a different VS Code windowToken Management:- Store OAuth tokens (access, refresh, expiry) per-deployment in secrets- Store dynamic client registrations per-deployment in secrets- Proactive token refresh when approaching expiry (via response interceptor)- Reactive token refresh on 401 responses with automatic request retry- Handle OAuth errors (invalid_grant, invalid_client) by prompting for  re-authenticationIntegration:- Add auth method selection prompt when server supports OAuth- Attach OAuth interceptors to CoderApi for automatic token refresh- Clear OAuth state when user explicitly chooses token auth- DeploymentManager coordinates OAuth session state with deployment changesError Handling:- Typed OAuth error classes (InvalidGrantError, InvalidClientError, etc.)- Parse OAuth error responses from token endpoint- Show re-authentication modal for errors requiring user action
@EhabY
Copy link
CollaboratorAuthor

#633 includes some open threads that I addressed here but unsure about whether to revert or refine so please check open threads out, mainly:

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@code-ashercode-asherAwaiting requested review from code-asher

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@EhabY

[8]ページ先頭

©2009-2025 Movatter.jp