supabase / auth

A JWT based API for managing users and issuing JWT tokens
https://supabase.com/docs/guides/auth
MIT License
1.43k stars 348 forks source link

Auth.SignUp forces email or phone #1201

Closed andrhubb closed 1 year ago

andrhubb commented 1 year ago

I want to create a user to have both email and phone provider auth and it is proving rather difficult to get past the following implemented goTrue-dart line.

149 - assert((email != null && phone == null) || (email == null && phone != null), 150 - 'You must provide either an email or phone number');

The ability to create a user with both email and phone parameters makes things a lot easier when verifying both before future authentications.

Is there a reason for this implementation? Can it be tweaked for the condition where both phone and email providers are being used?

dshukertjr commented 1 year ago

Let me transfer this issue to the Gotrue repo to see what the auth team thinks about this question.

kangmingtay commented 1 year ago

@andrhubb you can always call signUp with either email / phone first and then call the updateUser method subsequently, there are quite a few edge cases around allowing one to signUp with both email and phone which aren't trivial to tackle.

kangmingtay commented 1 year ago

i'm gonna close this issue for now since we don't plan to work on this but feel free to reopen it if i've misunderstood the issue, thanks!

andrhubb commented 1 year ago

Thanks yeah I figured it out. signUp with phone, verify, updateUser and verify. Although you need to adapt the modify email template.

Good to know

Kind regards, Andrew

On Mon, 31 Jul 2023 at 18:22, Kang Ming @.***> wrote:

i'm gonna close this issue for now since we don't plan to work on this but feel free to reopen it if i've misunderstood the issue, thanks!

— Reply to this email directly, view it on GitHub https://github.com/supabase/gotrue/issues/1201#issuecomment-1658830072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRZ2VZNAUS3E4FUH2K6OCDXS7SWBANCNFSM6AAAAAA253VH5A . You are receiving this because you were mentioned.Message ID: @.***>