Unable+to+exchange+external+code
Help Needed with Supabase Authentication: Discord Integration Fails to Exchange Code
We’re experiencing an issue with Supabase Authentication when integrating Discord as an OAuth provider. Here’s the background:
Current Status
The returned URL from Supabase looks like this:
https://ourdomain.com/login#error=server_error&error_code=unexpected_failure&error_description=Unable+to+exchange+external+code%253A+AkNWP1trHiCmeV4DhOOCpD4XBcpgEE
Thanks in advance for your help.
We’re experiencing an issue with Supabase Authentication when integrating Discord as an OAuth provider. Here’s the background:
Current Status
- Our application is live in both production and development environments.
- Google Authentication is working perfectly in both environments.
- After adding Discord as a provider, the OAuth flow does not work as expected.
- Specifically, the
codeparameter in the callback redirect URL is
.null
- This is how we’re handling the code exchange on the server side:
The returned URL from Supabase looks like this:
https://ourdomain.com/login#error=server_error&error_code=unexpected_failure&error_description=Unable+to+exchange+external+code%253A+AkNWP1trHiCmeV4DhOOCpD4XBcpgEE
- From the error, it appears Supabase is unable to exchange the external code.
- Redirect URIs are correctly configured in both Discord and Supabase.
- The Discord application is set up to match the same flow as Google Authentication (client ID, client secret, scopes, etc.).
- This issue is consistent in both development and production environments.
- Are there any known compatibility issues or additional configurations required for Discord OAuth in Supabase?
- What could be causing the code parameter to be null?
- Is there a way to debug this further, or are there specific Supabase logs we should check?
Thanks in advance for your help.