mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
Merge pull request #7143 from supabase/J0_update_twilio_and_workos_docs
docs: update Twilio and WorkOS docs
This commit is contained in:
5 files changed
+38
-12
No files matched your search
@@ -9,12 +9,12 @@ import TabItem from '@theme/TabItem'
|
||||
|
||||
## Overview
|
||||
|
||||
In this guide we'll show you how to authenticate your users with SMS based OTP (One-Time Password) tokens.
|
||||
In this guide we'll show you how to authenticate your users with SMS based One-Time Password (OTP) tokens.
|
||||
|
||||
There are two reasons to use Supabase SMS OTP tokens:
|
||||
|
||||
- You want users to log in with mobile + password, and the mobile should be verified via SMS
|
||||
- You want users to log in with mobile ONLY (i.e. passwordless login)
|
||||
- You want users to log in with mobile number + password, and the mobile number should be verified via SMS
|
||||
- You want users to log in with mobile number ONLY (i.e. passwordless login)
|
||||
|
||||
We'll cover:
|
||||
|
||||
@@ -24,7 +24,7 @@ We'll cover:
|
||||
|
||||
What you'll need:
|
||||
|
||||
- A twilio account (sign up here: https://www.twilio.com/try-twilio)
|
||||
- A Twilio account (sign up here: https://www.twilio.com/try-twilio)
|
||||
- A Supabase project (create one here: https://app.supabase.com)
|
||||
- A mobile phone capable of receiving SMS
|
||||
|
||||
@@ -55,7 +55,7 @@ Select 'SMS', 'Identity & Verification', and 'With code' as options on the welco
|
||||
|
||||

|
||||
|
||||
When you're back on the https://www.twilio.com/console screen, you need to scroll down and click 'Get a trial phone number' - this is the number that you'll be sending SMSs from.
|
||||
When you're back on the [Twilio console screen](https://www.twilio.com/console), you need to scroll down and click 'Get a trial phone number' - this is the number that you'll be sending SMSs from.
|
||||
|
||||

|
||||
|
||||
@@ -71,7 +71,7 @@ You should now be able to see all three values you'll need to get started:
|
||||
|
||||
Now go to the Auth > Settings page in the Supabase dashboard (https://app.supabase.com/project/YOUR-PROJECT-REF/auth/settings).
|
||||
|
||||
You should see an option to enable Phone Signup.
|
||||
You should see an option to enable Phone Signup:
|
||||
|
||||

|
||||
|
||||
@@ -89,11 +89,13 @@ The SMS message sent to a phone containing an OTP code can be customized. This i
|
||||
|
||||
Go to Auth > Templates page in the Supabase dashboard (https://app.supabase.com/project/YOUR-PROJECT-REF/auth/templates).
|
||||
|
||||
Use the variable `.Code` in the template to display the code.
|
||||
Use the variable `.Code` in the template to display the OTP code. Here's an example in the SMS template.
|
||||
|
||||

|
||||
|
||||
### Using OTP with password based logins
|
||||
|
||||
In this use scenario we'll be using the user's mobile phone number as an alternative to an email address when signing up along with a password. You may want to think hard about the permanency of this however. It is not uncommon for mobile phone numbers to be recycled by phone networks when users cancel their phone contracts or move countries, therefore granting access to the user's account to whoever takes over the phone number in the future. Soon we'll add multi-factor auth, which will mitigate this risk, but for now you may want to give some thought to allowing your users to recover their account by some other means in an emergency.
|
||||
In this scenario we'll be using the user's mobile phone number and a corresponding password as an alternative to signing up with an email address. Note: please thoroughly consider potential security implications when signing up with a combination of phone number and password. Phone numbers are sometimes recycled by phone networks when users cancel their phone contracts or move countries, thereby granting access to the user's account to the subsequent owner of the phone number. In the near future Supabase will support multifactor authentication, which will mitigate this risk, but for now you may want to consider allowing your users to recover their account by some other means in an emergency.
|
||||
|
||||
Using supabase-js on the client you'll want to use the same `signUp` method that you'd use for email based sign ups, but with the `phone` param instead of the `email param`:
|
||||
|
||||
|
||||
@@ -11,12 +11,16 @@ To enable WorkOS Auth for your project, you need to set up WorkOS OAuth applicat
|
||||
|
||||
## Overview
|
||||
|
||||
WorkOS OAuth consists of four broad steps:
|
||||
In this guide, we will cover how to use Supabase OAuth with WorkOS to implement Single-Sign-On(SSO).
|
||||
|
||||
The procedure consists of five broad steps:
|
||||
|
||||
- Create a new organization from your WorkOS Dashboard.
|
||||
- Obtain the `Client ID` from the Configuration tab and configure redirect URI.
|
||||
- Obtain the `WorkOS Secret` from the credentials tab.
|
||||
- Connect a WorkOS Supported Identity Provider
|
||||
- Add your WorkOS credentials into your Supabase project
|
||||
|
||||
## Steps
|
||||
|
||||
### Create a WorkOS Organization
|
||||
@@ -27,6 +31,7 @@ Log in to the dashboard and hop over to the Organizations tab to create and orga
|
||||
### Obtain the Client ID and configure Redirect URI
|
||||
|
||||
Head over to the Configuration tab and configure the redirect URI.The redirect URI should look like `https://<project-ref>.supabase.co/auth/v1/callback`
|
||||
Note that this is distinct from the redirect URI referred to in the Supabase dashboard
|
||||
|
||||

|
||||
|
||||
@@ -36,22 +41,37 @@ Head over to the API Keys page and obtain the secret key.
|
||||
|
||||

|
||||
|
||||
### Connect a WorkOS Supported Identity Provider
|
||||
|
||||
Set up the identity provider by visiting the setup link.
|
||||
|
||||

|
||||
|
||||
You can pick between any one of the many identity providers that WorkOS supports.
|
||||
|
||||
### Add your WorkOS credentials into your Supabase Project
|
||||
|
||||
- Go to your [Supabase Project Dashboard](https://app.supabase.com)
|
||||
- In the left sidebar, click the `Authentication` icon (near the top)
|
||||
- Click `Settings` from the list to go to the `Authentication Settings` page
|
||||
- Under `External OAuth Providers` turn `WorkOS Enabled` to ON
|
||||
- Enter the `Client ID`, `Secret`, and `WorkOS URL` saved in the previous steps
|
||||
- Enter the `Client ID`, `Secret`, and `WorkOS URL` saved in the previous steps. The ``WorkOS URL` setting should be set to https://api.workos.com/
|
||||
- Click `Save`
|
||||
|
||||
|
||||
|
||||
### Add login code to your client app
|
||||
|
||||
The JavaScript client code is documented in the [Supabase OAuth Reference](/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers).
|
||||
The JavaScript client code is documented in the [Supabase OAuth Reference](/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers). Note that you only need to include one of the three parameters: `connection`, `organization`, and `provider`.
|
||||
You can refer to the [WorkOS Documentation](https://workos.com/docs/reference/sso/authorize/) to learn more about the different methods.
|
||||
|
||||
```js
|
||||
const { user, session, error } = await supabase.auth.signIn({
|
||||
provider: 'workos',
|
||||
}, {
|
||||
connection: "<your_connection>",
|
||||
organization: "<your_organization",
|
||||
provider: "<your_provider>"
|
||||
})
|
||||
```
|
||||
|
||||
@@ -61,7 +81,11 @@ Add a function which you can call from a button, link, or UI element.
|
||||
async function signInWithWorkOS() {
|
||||
const { user, session, error } = await supabase.auth.signIn({
|
||||
provider: 'workos',
|
||||
}
|
||||
}, {
|
||||
connection: "<your_connection>",
|
||||
organization: "<your_organization",
|
||||
provider: "<your_provider>"
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 377 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 245 KiB |
Reference in new issue
Block a user