supabase-flutter icon indicating copy to clipboard operation
supabase-flutter copied to clipboard

OTP {{.Token}} works for login after account created but not for sign-up.

Open MichealReed opened this issue 2 years ago • 4 comments

Bug report

  • [x ] I confirm this is a bug with Supabase, not with my own application.
  • [ x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Using the OTP from {{.Token}} from the email template works for logins but not for signups.

To Reproduce

Steps to reproduce the behavior:

  1. Add {{.Token}} to email template on a project. 2. await _supabaseClient.auth.verifyOTP(email: email, token: code, type: OtpType.magiclink); (flutter version) 3. The code generates a invalid or expired error.

Expected behavior

The generated OTP should work for sign-up the same as it works for login.

Additional context

We could pass OtpType.signup, but it is unknown on how we can detect which is needed from the frontend. Handling this via error catching is redundant. It would be optimal if signup and magiclink could be combined.

https://github.com/supabase/supabase-flutter/issues/395

MichealReed avatar Nov 03 '23 01:11 MichealReed

try to use type: "email"

landsman avatar Nov 06 '23 10:11 landsman

try to use type: "email"

There is not a email type on the flutter implementation.

image

I have a work around in place that catches the error with the magiclink type and then calls the same function with sign-up but as mentioned this is overly complex and redundant.

MichealReed avatar Nov 06 '23 14:11 MichealReed

It is in JS SDK: https://github.com/supabase/gotrue-js/blob/master/src/lib/types.ts#L595 So you probably want to open issue in this repository: https://github.com/supabase/supabase-flutter to add it.

landsman avatar Nov 06 '23 19:11 landsman

@MichealReed Which supabase_flutter version are you using? It should exist.

Vinzent03 avatar Dec 19 '23 20:12 Vinzent03