Please add custom Query Parameters to Supabase Login with MagicLink action

I need to pass some values ​​to the page after the user is redirected from an email link. There is a field “Email redirect to”, but no “Query Parameters”, so I have to either use variables or construct part of the URL with parameters myself and pass it to the “Email redirect to” field. Both ways are not very convenient. Please add a separate field for query parameters.

Update: I found that the custom URL doesn’t work in production because it uses wwLib.websiteData.getPages() which takes an ID and finds the page, so if the URL contains an extra query it fails. So the only option is to use variables which is very inconvenient for me.

Hey @Roman_N :waving_hand:

Thanks a lot for your feedback. Just passed it on to the product team :slight_smile:

Hello.
I wonder if there is any news or plans to release this? Thank you.

1 Like

Hi Roman, we are not planning on updating this action.

But you can set the query in the redirectPage parameter.

wwLib.wwPlugins.supabaseAuth.signInMagicLink({"email":"","redirectPage":"","captchaToken":""})

Hope this helps.

1 Like

stumbled on the same problem, will try this, thanks

so, after trying, maybe Agustin meant not the same function we have in the workflow, but the underneath function. The signInWithMagicLink takes an UID for the redirectPage param, as the action available in the workflows.

instead, using this lower level function:

wwLib.wwPlugins.supabaseAuth.publicInstance.auth.signInWithOtp

i can send any URL i want for the redirectTo, solving this thread problem with the getPages() in the signInWithMagicLink returning the same url for everyone.

This is the js custom code i’m using.

const { data: i, error: l } = await wwLib.wwPlugins.supabaseAuth.publicInstance.auth.signInWithOtp({
  email: context.local.data?.["form"]?.["fields"]?.["email"]?.["value"],
  options: {
    emailRedirectTo: globalContext.browser?.["url"],
    captchaToken: "",
  },
});
if (l)
  throw new Error(l.message, {
    cause: l,
  });

@Agustin_Carozo do you see any problem in doing this? thanks

1 Like

Hi @vfede

Nice that you implemented that! This is a Supabase SDK thing, it’s not specific to WeWeb. It seems ok for now. Please check their documentation: JavaScript API Reference | Supabase Docs and let us know via chat support if you face any issues.

Thank you.

TL;DR for the others, if you want to redirect a magic link sign-in:

  • to an existing page in weweb as is: then use the Supabase action built-in in Weweb and use a Page ID as parameter
  • to a weweb page that has a custom URL with eventual slugs and query parameters: use the low-level Supabase SDK function in my code, and provide the full URL to it.

Hope it helps :slight_smile:

2 Likes