Add OAuth 2.0 PKCE login for native apps and optional GitHub login - #620
Open
AMDphreak wants to merge 1 commit into
Open
Add OAuth 2.0 PKCE login for native apps and optional GitHub login#620AMDphreak wants to merge 1 commit into
AMDphreak wants to merge 1 commit into
Conversation
CLI tools can complete a loopback authorization-code flow instead of posting a registry password; GitHub login is available when an OAuth App is configured. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
GET /oauth/authorize,POST /oauth/token, andPOST /oauth/revokeissue Bearer tokens that work on existing owner routes (Authorization: Bearer). Redirect URIs are restricted to127.0.0.1/localhost/[::1]./login/github+/login/github/callback) whengithub-oauth-client-id/github-oauth-client-secretare set. This is a step toward Implement OAuth support for Github login & package management #475; org-based package management is not in this PR.Test plan
dub test(PKCE RFC 7636 vector, loopback URI checks, Bearer header parsing)GET /login/githubreturns 503GET /oauth/authorize?response_type=code&client_id=native&redirect_uri=http://127.0.0.1:<port>/callback&code_challenge=<S256>&code_challenge_method=S256&state=xyzredirects to login, then consent, then the loopback callback withcodeerror=access_deniedredirect_uri(non-loopback) shows an error page and does not redirectPOST /oauth/tokenwith matchingcode_verifierreturns a Bearer token; reuse of the same code failsAuthorization: Bearer <token>canPOST /register_package(or load/my_packages) as the logged-in userSee
api-docs/oauth.mdfor the client flow.Made with Cursor