Skip to content
Init is coming / May 19 - 23
Back

OAuth fails with Invalid Response or invalid Callback url

  • 0
  • Self Hosted
  • Flutter
  • Auth
V
9 May, 2025, 22:42

Im currently trying to use the Discord Oauth but i cant find a way to make it work. I followed the docs and set up the discord oauth application and enabled it in appwrite auth.

using the example provided in the docs

TypeScript
await account.createOAuth2Session(
        provider: OAuthProvider.discord,
        scopes: ['identify'],
      );

throws the ArgumentError 'Callback url scheme must start with http://localhost:{port}'

providing a succsess and failure url

TypeScript
await account.createOAuth2Session(
        provider: OAuthProvider.discord,
        success: 'http://localhost:3000',
        failure: 'http://localhost:3000',
        scopes: ['identify'],
      );

results in an invalid OAuth2 Response. Key and Secret not available. This is because the return value is just the success url "http://localhost:3000" the user gets acually created but i dont have a valid user session

Platform: Windows Appwrite Version: 1.6.1

TL;DR
Issue: OAuth setup for Discord is failing with "Invalid Response" or "invalid Callback URL" errors. Using the provided example code and setting up success/failure URLs results in incorrect OAuth2 responses. Solution: Ensure the callback URL scheme begins with "http://localhost:{port}". Update the URLs to match this format, ensuring the correct port number. This should resolve the OAuth issues for Discord authentication.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more