Search code examples
supabasesupabase-database

Get token parameter inside of .ConfirmationURL to reset password on reset password template supabase


i need get the token to reset password user in the reset password email template becuase i will send this token in firebase deep link but the parameter .ConfirmationURL has url with more information, i just need get the token, there is the posibility of get this parameter with a especific name inside the template as .ConfirmationURL? thanks

Update i have configuration all parameter as shown in the documentation:

  1. Additional redirect URLs

enter image description here

  1. FLutter initialization

    await Supabase.initialize( url: supabaseUrl, anonKey: supabaseAnnonKey, authCallbackUrlHostname: 'login-callback', debug: true, localStorage: SecureLocalStorage(), );

  2. if i send the reset email this send fine with a link as the picture, the content of link is this

https://xxxxxxxxxxxxx.supabase.co/auth/v1/verify?token=kiaknuztglhtdcynoaog&type=recovery&redirect_to=https://localhost:3000

enter image description here

Now if i click in the link since the phone, it does not redirect me to the application, but the user is logged in the supabase panel automatically.

enter image description here

I dont understand what i do wrong and for this reason i try use firebase to deep links but the access_token parameter cannot be accessed. so i think that i need help in the last step

enter image description here

Update 2

Finally works, i use the parameter redirectTo inside of resetPasswordEmail and the deeplink connect with the app:

    response = await clientSupabase.auth.api.resetPasswordForEmail(
    datauser.email,
    options: AuthOptions(redirectTo: Credentials.myAuthRedirectUri),
  );
  1. Aditional i use the next configuration in setting configuration authentication supabase:

enter image description here

  1. In flutter code i use the next method in the login page, this method just is called when the user clik the link in the reset password mail:

    @override void onReceivedAuthDeeplink(Uri uri) {}


Solution

  • The problem seems that you are redirecting to localhost:3000 upon sign up, but you actually want to redirect to the deeplink you have setup.

    When you signup, you can provide a options with redirectTo set as the deeplink you have setup within Supabase's console to redirect the user to a certain page instead of the default site URL.

    Supabase.instance.client.auth
      .signUp('email', 'password', options: AuthOptions(redirectTo: 'io.supabase.flutterquickstart://login-callback/'));