feat: add discord oauth login#234
Closed
LucHeart wants to merge 43 commits into
Closed
Conversation
Contributor
|
@codex this PR is unfinished, still needs some extra logic around adding OAuth connections to accounts and creating accounts from OAuth, but how does it look till now? |
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
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.
This PR introduces OAuth2 authentication and account linking into the API, starting with Discord as the first supported provider.
🔑 Key Additions
OAuth Controller & Endpoints
GET /oauth/providers– list supported providers.GET /oauth/{provider}/authorize– begin login-or-create flow.GET /oauth/{provider}/handoff– process provider callback, either sign in or continue flow.GET /oauth/{provider}/data– retrieve handoff data (email, display name, expiry).POST /oauth/{provider}/finalize– finalize flow: create a new account or link to an existing one.Account OAuth Connections
GET /account/connections– list linked connections.GET /account/connections/{provider}/link– initiate link flow.DELETE /account/connections/{provider}– unlink a provider.Database & Services
UserOAuthConnectionstable.OAuthConnectionServicefor managing external identities.AccountServicewith support for creating OAuth-only accounts (passwordless).Authentication & Config
AuthConstantswith flow types (login-or-create,link).⚙️ Step-by-Step Flow
Frontend requests login/signup with Discord
→ Calls
GET /oauth/discord/authorizeRedirect to Discord
→ User consents and Discord redirects back to
/oauth/discord/handoffHandoff decision
oauth/discord/create(new account) oroauth/discord/link(link existing account).Frontend fetches temporary identity data
→ Calls
GET /oauth/discord/datato display email/display name.Finalize flow
POST /oauth/discord/finalizecreate→ new OAuth-only account is created and linked.link→ external identity is attached to the logged-in account.OAuth connection persisted
→ Stored in
UserOAuthConnectionsand accessible under/account/connections.🚀 Impact