Discord OAuth Setup Guide
Follow these steps to enable Discord login for your app
Open your Discord application settings:
Discord Developer PortalNavigate to: OAuth2 → Redirects
You need two redirect URLs registered. Click "Add Redirect" for each:
① Account Linking (profile → link Discord)
https://doordiehub.com/functions/discordOAuthCallback② Platform SSO Login — Web/Browser (desktop + mobile browser)
https://base44.app/api/apps/690788bbf9e29b9d99491d7d/auth/sso/callback③ Platform SSO Login — Native App (iOS/Android Base44 app — REQUIRED or login fails on mobile)
https://app.base44.com/api/apps/690788bbf9e29b9d99491d7d/auth/sso/callbackCRITICAL: All Three URLs Required
The platform uses different callback domains depending on where the user starts login:
• Browser (desktop + mobile browser) → uses base44.app
• Native app (iOS/Android Base44 app) → uses app.base44.com
If URL ③ is missing, native app login fails with "Discord authentication failed" — the error appears on app.base44.com and the user is never redirected back into the app. This is the exact symptom of a missing app.base44.com redirect URI.
Note: After adding both, click "Save Changes" at the bottom of the page!
These sso_* secrets control the platform's Discord SSO login flow. Set them in your Base44 dashboard under Settings → Environment Variables:
sso_client_id= your Discord Client IDsso_client_secret= your Discord Client Secretsso_scope= identify emailsso_auth_endpoint= https://discord.com/api/oauth2/authorizesso_token_endpoint= https://discord.com/api/oauth2/tokensso_userinfo_endpointMUST BE PROXYDiscord returns id instead of the OIDC sub field. The Base44 SSO requires sub to identify the user. Set this to the OIDC proxy function URL:
https://base44.app/api/apps/690788bbf9e29b9d99491d7d/functions/discordOIDCUserinfoThis proxy receives the Discord access token from the platform SSO, calls Discord's /users/@me, and reshapes the response to include sub, email_verified, and other OIDC fields.
Also verify: DISCORD_CLIENT_ID, DISCORD_CLIENT_SECRET, and DISCORD_REDIRECT_URI are set (used for account linking).
After completing the above steps, try these features:
- Link Discord from your profile settings
- Sign in with Discord button (prompts when not logged in)
- Purchase membership (requires Discord link)
"Discord authentication failed" after clicking Authorize
This means the platform SSO received the Discord callback but the OAuth exchange failed. Three causes:
- Missing
app.base44.comredirect URI: The native iOS/Android app usesapp.base44.comas the SSO callback domain, NOTbase44.app. If only thebase44.appredirect is registered (URL ②), browser login works but the native app fails. Add URL ③ (app.base44.comversion) to fix native app login. - Missing
base44.appredirect URI: Browsers usebase44.appas the SSO callback domain. If only theapp.base44.comredirect is registered, native app login works but browser login fails. Add URL ② to fix browser login. - OIDC proxy not configured: The
sso_userinfo_endpointsecret doesn't point to the OIDC proxy. Set it to the proxy URL from Step 3.
"Invalid OAuth2 redirect_uri" Error
The redirect URL in Discord must EXACTLY match what's in Step 2. No trailing slashes.
404 Page Not Found
Wait 1-2 minutes after saving changes in Discord. The backend function needs to be deployed.
Login Page Doesn't Show Discord
Base44's built-in login page can't be customized. Discord login appears in-app via prompts and profile settings.
