-
Notifications
You must be signed in to change notification settings - Fork 10
feat: add discord oauth login #234
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
Conversation
|
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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