Provider invalid OAuth2 redirect_uri

I am getting an error when I try to sign in with Discord on my prod environment. I don't have this issue locally

I get Invalid OAuth2 redirect_uri and I checked the browser logs
GET
    https://discord.com/api/v9/oauth2/authorize?client_id=1344915763433308160&response_type=code&redirect_uri=https://mercury-development.up.railway.app/api/auth/callback/discord&scope=identify email&state=mU-CwQ_BRKfaE3x6a3t8_0cKiRnUFu4R&integration_type=0


The redirect uri is the backend where better-auth is set up https://mercury-development.up.railway.app/api/auth/callback/discord

the request cookie has the __secure prefix

I think my oauth2 redirect uri is set up correctly, it's basically the same for local and prod as well
CleanShot_2025-04-13_at_13.23.51.png
Was this page helpful?