https://supabase.com/ logo
Auth UI oauth redirect not working properly with React SPA
m

maikeriva

05/25/2023, 2:37 PM
Hello everyone! I am building a small authenticator app to integrate with a 3rd party service. The app is built as a very simple React single page application and uses react-router for url management and the Auth UI component. The app is hosted on
https://example.org
, and initially prompts the user to sign in with supabase. When he does so, he is redirected to
https://example.org/redirect
, an internal route which first runs an edge function, then redirects again the user to the 3rd party service. It works fine with email sign-in, but not with oauth providers. After signing in with google, for example, the redirect is invoked... but without the
/redirect
part. After some troubleshooting I found out the following: - The allowed URLs in my supabase control panel are correct - If I manually browse to
https://example.org/redirect
, the page is opened correctly and the app works as intended - If I change the redirect to another whitelisted static page (so NOT a React SPA), the
/redirect
part is appended correctly - I tested a different hosting provider for the app, and the result did not change I am thinking it could be because I am implementing this flow as a single page application, but isn't it an extremely common scenario to have with supabase? What might be wrong? Is it a bug? Thanks for any assistance 🙂
s

silentworks

05/25/2023, 4:03 PM
Can you share what part of your code isn't working also do you have a repo with this code?
The url for the
redirectTo
should be the full url
https://example.org/redirect