Discourse SSO with Supabase Magic Link login

I have a NextJS + Supabase app where I'm using magic link for Auth. I also have a Discourse (https://www.discourse.org) instance setup on one of the app subdomains. I want to log in to the Discourse forum using the Supabase Auth already setup. Discourse allows for this by including a payload containing the redirect_url in the url for the login route (see screenshot and doc link below). How can I include this in the magic link that Supabase sends to the user's email? (I'm using Amazon SES for the custom SMTP)

Supabase login code in my app:
const { error } = await supabaseClient.auth.signIn(
        { email: email },
        {
          redirectTo: `http${
            process.env.NODE_ENV == "production" ? "s" : ""
          }://app.${process.env.NEXT_PUBLIC_APP_DOMAIN}/dashboard`,
        }
      );

Reference doc for setting up SSO in Discourse: https://meta.discourse.org/t/setup-discourseconnect-official-single-sign-on-for-discourse-sso/13045
Screenshot_2022-10-07_at_11.22.33_AM.png
Discourse - Civilized Discussion
Discourse is modern forum software for your community. Use it as a mailing list, discussion forum, long-form chat room, and more!
Discourse Meta
DiscourseConnect allows you to configure “Single Sign-On (SSO)” to completely outsource all user registration and login from Discourse to another site. ℹ (Feb 2021) ‘Discourse SSO’ is now ‘DiscourseConnect. If you are running an old version of Discourse, the settings below will be named sso_... rather than discourseconnect... The Probl...
Was this page helpful?