Support Supabase phone and OTP authentication#3177
Support Supabase phone and OTP authentication#3177dthyresson merged 2 commits intoredwoodjs:mainfrom
Conversation
| signup(options: { | ||
| email: string | ||
| password: string | ||
| email?: string |
There was a problem hiding this comment.
Do you think we could change this to be like:
options: EmailAuth | SmsAuth | RefreshToken | OtherAuth
There was a problem hiding this comment.
Possibly, but I chose to match the Supabase GoTrue client:
async signUp(
{ email, password, phone }: UserCredentials,The just have one type:
export interface UserCredentials {
email?: string
phone?: string
password?: string
refreshToken?: string
// (Optional) The name of the provider.
provider?: Provider
}I see that it would make sense, but seems more practical to follow the Supabase client lead to keep in sync.
Maybe we should make that suggestion to them, actually.
* 'main' of github.com:redwoodjs/redwood: Improved useMatch to support search parameters (redwoodjs#2683) Supports SDL and Scaffold generation for Float scalar types (redwoodjs#3218) Allow custom functions to serve binary data (redwoodjs#3219) Support Supabase phone and OTP auth (redwoodjs#3177)
|
Sorry for bumping an old thread, but how exactly is |
Hi @domnantas you can get the “client” from useAuth. That will be the Supabase client and the instance of the auth client from that: client.auth.verifyOTP You can also do “client.auth” and access all the go-true client methods. |
|
Sweet, thanks! I can take care of updating the docs since I wasn't able to find any mention of that 😅 |
|
I did this: await client.auth.verifyOTP({ phone, token, redirectTo: routes.home() })It did send a request to supabase and I got a response with EDIT: |
Hi @domnantas I'm following this issue in the Supabase gotrue-js repo and since this issue here in RW is closed, perhaps we create a new issue for this and link the two issues you noted. I does seem Supabase has an issue refreshing auth after the OTP is verified. Would you mind creating a new issue and adding some example code how how you request and pass the OTP for verification? That way we can create a small project -- or better yet add it to SMS auth to https://github.com/redwoodjs/playground-auth |
|
@domnantas I chatted with Supabase and let's open a Discussion here: https://github.com/supabase/supabase/discussions That way I can respond and also get the Supabase support people to help. |
Fixes #3131
Fixes #3140
Supabase now supports SMS one-time-passwords with Twilio.
You can sign in and up with a phone number and optional password.
If using phone auth, you will need to verify the one-time-password (OTP) and therefore the
verifyOTPfunction of the Supabase GoTrue client is now exposed.See: https://supabase.io/docs/guides/auth/auth-twilio for more info
This PR and simplifies the logic in the signIn to just forward the request to the client and not replicate the logic for which params are needed.
Docs added: https://github.com/redwoodjs/redwoodjs.com/pull/762