Superbase Auth flows with provider

Hi,

In my web app, I’m using Login with LinkedIn for Auth with Superbase. I have set up the URL configuration in Superbase which allows me to redirect to the right page post-auth.

I am having issues using different auth flows. For example:

  • If I log in on the editor page in preview mode, I would like the Superbase Auth to redirect to the editor page post auth.

  • If I log in from my preview domain, I would like the Superbase Auth to redirect to the preview domain.

  • If I log in on my custom domain page, I would like the Superbase Auth to redirect to my custom domain.

What I have tried:

  • I setup the site URL in Supabase to the editor for now but also added redirect urls for each of the above mentioned scenarios.

  • I added multiple if conditions in the login workflow in Weweb to redirect to the urls based on the Browser.baseurl

  • When I go through the auth flow current I am redirected to a blank page on the editor flow

Has anyone implemented such a flow? Any tips or pointers on how I can achieve this?

Hey Abhisahni,

You’ll want to dynamically set the redirectTo parameter in your Supabase login call to match the current page or domain before starting the auth flow. Supabase will then redirect users back to that exact URL after login, as long as it’s whitelisted in your dashboard. Make sure the redirect URLs you register in Supabase match exactly (including protocol and path) what you pass during login. The blank page usually happens if the redirect URL isn’t handled properly by your app or doesn’t match what’s registered. If you need, I can share some code examples for setting this up.

2 Likes