πŸ” Authentication

Manage your users through Supabase Auth service.

In this section, we cover the essential aspects of user authentication within your Bubble.io application using the Supabase plugin.
❗
Note: Please ensure that a Supabase Auth component is visible on every page of your app. This is crucial because this component initiates the connection with your Supabase instance. Note that you can have multiple instances of the Supabase Auth component.

Setup

Add the element Supabase Auth to your page.
Image without caption
Image without caption
Image without caption
Fields:
Title
Description
Type
DB Schema
The Postgres schema which your tables belong to.
Text
Datatype identity
Optional. Select "Identity (Supabase)" for this field. This type is automatically defined by the Supabase plugin and allows exposing identities linked to the current user.
App type
Datatype MFA
Optional. Select "MFA (Supabase)" for this field. This type is automatically defined by the Supabase plugin and allows exposing MFA factors.
App type
Auto Refresh Token?
Automatically refreshes the token for logged-in users.
Yes/No
Persist Session?
Whether to persist a logged-in session to storage.
Yes/No
Detect Session In Url?
Detect a session from the URL.
Yes/No
Set Session From Url?
When this option is enabled, the plugin automatically attempts to set the user session based on values retrieved from the URL (after an email or OAuth redirect). Otherwise, you'll need to manually trigger the Set User Session action, such as on page load.
Yes/No
Real-Time Events Per Second
Rate limiting. The default is 10, which means that the client can send one event every 100 milliseconds.
Number
JSON headers
Optional headers for initializing the client. They will be automatically included in action calls to your Supabase instance.
JSON
Enable retry?
Enables the retry mechanism for failed network requests. If set to true, the plugin will attempt to retry the request upon encountering client-side network errors. Defaults to false.
Yes/No
Max retries
The maximum number of retry attempts after a failed request. If not provided, it defaults to 3 retries.
Number
Initial delay (in ms)
The initial delay in milliseconds before the first retry attempt. Subsequent retries will use exponential backoff, meaning the delay will double after each retry (e.g., if set to 500, the next retry will be after 500ms, then 1000ms, and so on). Defaults to 500 ms.
Number
Datatype (User metadata)
Optional. Data type that you have initialized through the API connector. Allows you to retrieve the user metadata you defined during user signup.
App type
Expected user metadata (JSON)
Optional. By default, the plugin attempts to automatically retrieve the user metadata format based on the type defined in the API connector. To prevent any retrieval failures and ensure that the plugin can properly publish results from Supabase, we recommend you paste your schema into this field. This schema should match the one you have already entered in the API connector.
JSON
Datatype (Custom claims)
Optional. Data type that you have initialized through the API connector. Allows you to retrieve the custom claims you defined on your Supabase project.
App type
Expected custom claims (JSON)
Optional. By default, the plugin attempts to automatically retrieve the custom claims format based on the type defined in the API connector. To prevent any retrieval failures and ensure that the plugin can properly publish results from Supabase, we recommend you paste your schema into this field. This schema should match the one you have already entered in the API connector.
JSON

Exposed states

Name
Description
Type
Is Logged In
Indicates if user is logged-in or not.
Boolean
User ID
Unique identifier of the current user.
Text
User Email
Email address of the current user.
Text
New email
New email address when changing email.
Text
Email change sent at
Timestamp when email change request was sent.
Date/Time
User Email Confirmed At
Timestamp when user email was confirmed.
Date/Time
User Phone
Phone number of the current user.
Text
New phone
New phone number when changing phone.
Text
User Last Sign In At
Timestamp of the last user sign-in.
Date/Time
User Confirmed At
Timestamp when user account was confirmed.
Date/Time
User Phone Confirmed At
Timestamp when user phone was confirmed.
Date/Time
User Created At
Timestamp when user account was created.
Date/Time
User Updated At
Timestamp when user account was last updated.
Date/Time
User Aud
Audience claim from the JWT token.
Text
User Role
Role assigned to the current user.
Text
Access Token
JWT access token.
Text
Refresh Token
JWT refresh token.
Text
Token Type
Type of the authentication token.
Text
Expires At
Timestamp when the token expires.
Date/Time
Expires In
Time in seconds until token expiration.
Number
Is anonymous?
Indicates if the user is anonymous.
Boolean
Identities
List of identities linked to the current user.
List
User metadata
Current user metadata.
Object
Custom claims
Current user custom claims.
Object
MFA
Current user MFA factors.
List
App Metadata Provider
The provider used to authenticate the user (e.g. email).
Text
App Metadata Providers
List of authentication providers.
List
Status Code
Authentication status code (e.g. 'success', 'failed').
Text
Status Message
Message returned by the Supabase authentication service.
Text
Auth Event
The last authentication event received.
Text
User Metadata Avatar Url
Avatar URL from user metadata (OTP/OAuth).
Text
User Metadata Email
Email from user metadata (OTP/OAuth).
Text
User Metadata Email Verified
Indicates if email is verified (OTP/OAuth).
Boolean
User Metadata Full Name
Full name from user metadata (OTP/OAuth).
Text
User Metadata Iss
Issuer claim from user metadata (OTP/OAuth).
Text
User Metadata Name
Name from user metadata (OTP/OAuth).
Text
User Metadata Phone Verified
Indicates if phone is verified (OTP/OAuth).
Boolean
User Metadata Picture
Picture URL from user metadata (OTP/OAuth).
Text
User Metadata Provider Id
Provider ID from user metadata (OTP/OAuth).
Text
User Metadata Sub
Subject claim from user metadata (OTP/OAuth).
Text
URL Access Token
Access token extracted from URL (after redirect).
Text
URL Refresh Token
Refresh token extracted from URL (after redirect).
Text
URL Type
Token type extracted from URL (after redirect).
Text
URL Error
Error message extracted from URL (after redirect).
Text
URL Error Code
Error code extracted from URL (after redirect).
Text
URL Error Description
Error description extracted from URL (after redirect).
Text
Error Slug
Simple text describing the authentication error.
Text
Error Code
Unique code (number) for the authentication error.
Number

Login with password errors

Description
Code
Slug
Invalid login credentials
100
invalid-login-credentials
Email not confirmed
101
email-not-confirmed
Phone number not confirmed
102
phone-number-not-confirmed
Email login disabled
103
email-login-disabled
Phone number login disabled
104
phone-number-login-disabled
Database error
105
database-error
Error generating JWT token
106
error-generating-jwt-token
Captcha verification process failed
107
invalid-captcha

Signup errors

Description
Code
Slug
Email already in use
200
email-already-in-use
Signups not allowed for this instance
201
signups-not-allowed
Password should be at least X characters
202
password-too-short
Only an email address or phone number should be provided on signup.
203
only-email-or-phone-number
Invalid channel, supported values are sms or whatsapp
204
invalid-channel
PKCE not supported for phone signups
205
pkce-not-supported-for-phone-number
Email signups are disabled
206
email-signup-disabled
Database error finding user
207
database-error-signup
Phone signups are disabled
208
phone-number-signup-disabled
User already registered
209
user-already-registered

Update errors

Description
Code
Slug
Auth session is missing
300
auth-session-missing

Login anonymously errors

Description
Code
Slug
Captcha verification process failed
400
invalid-captcha

Element Events

Name
Description
Supabase is loaded
Triggered when the Supabase plugin has been loaded.
Auth State Changed
Triggered when receiving a new authentication event from Supabase.
Auth Error Received
Triggered when receiving an authentication error from Supabase.
Signed Up
Triggered when a user successfully signs up.
Signed Up Error
Triggered when an error occurs during the user sign-up process.
Sign In
Triggered when a user successfully signs in.
Sign In Error
Triggered when an error occurs during the user sign-in process.
Signed Out
Triggered when a user successfully signs out.
Signed Out Error
Triggered when an error occurs during the user sign-out process.
User Updated
Triggered when a user's account information is successfully updated.
User Updated Error
Triggered when an error occurs while updating a user's account information.
Verify OTP
Triggered when an OTP has been successfully verified.
Verify OTP Error
Triggered when an OTP is not valid.
Sign in with OTP
Triggered when a user has successfully signed in with an OTP.
Sign in with OTP error
Triggered when an error occurs while signing in with an OTP.
OTP resend
Triggered when an OTP has been successfully resent.
OTP resend error
Triggered when an error occurs while resending an OTP.
Identity linked
Triggered when an identity is linked.
Identity linked error
Triggered when an error occurs while linking identity.
Identity unlinked
Triggered when an identity is unlinked.
Identity unlinked error
Triggered when an error occurs while unlinking identity.
Send password reset request
Triggered when a password reset request has been successfully sent.
Send password reset request error
Triggered when an error occurs while sending a password reset request.
Sign in anonymously
Triggered when a user successfully signs in anonymously.
Sign in anonymously error
Triggered when an error occurs during the user's attempt to sign in anonymously.
Send password reauthentication nonce
Triggered when a password reauthentication nonce has been successfully sent.
Send password reauthentication nonce error
Triggered when an error occurs while sending a password reauthentication nonce.
Refresh user session
Triggered when the user session has been refreshed.
Refresh user session error
Triggered when an error occurs while refreshing the user session.
Set user session
Triggered when the user session has been set.
Set user session error
Triggered when an error occurs while setting the user session.
MFA enroll
Triggered when a user has successfully enrolled in MFA.
MFA enroll error
Triggered when an error occurs while enrolling a user in MFA.
MFA challenge
Triggered when a MFA challenge is required.
MFA challenge error
Triggered when an error occurs while challenging a user for MFA.
MFA verify
Triggered when a user has successfully verified their MFA factor.
MFA verify error
Triggered when an error occurs while verifying a user's MFA factor.
MFA unenroll
Triggered when a user has successfully unenrolled from MFA.
MFA unenroll error
Triggered when an error occurs while unenrolling a user from MFA.
❗
Note: Explore our demo app to see how to effectively use the auth component in your app.

Element Actions

Sign the user up

Log the user in with password

Logout a user

Update user

Log the user in with OTP

Log the user in with OAuth

Set user session

Verify OTP

Send a password reset request

Log the user in anonymously

Link an OAuth identity

Unlink an OAuth identity

Send a password reauthentication nonce

Refresh user session

Resend OTP

Enroll a factor (MFA)

Create and verify a challenge (MFA)

Unenroll a factor

Log the user in with SSO