All Products
Search
Document Center

ApsaraDB RDS:Authentication

Last Updated:Mar 28, 2026

The RDS Supabase Authentication module manages user identities for your application. It supports email, phone number (SMS), and OAuth sign-up flows, along with standard sign-in, profile update, and sign-out operations.

Setting up any authentication method involves two steps:

  1. Set the required parameters in the Supabase Auth configuration on the Alibaba Cloud Management Console.

  2. Call the corresponding Supabase JavaScript SDK method in your application.

Prerequisites

Before you begin, make sure you have:

  • An RDS Supabase instance

  • Access to the Alibaba Cloud Management Console

  • The Supabase JavaScript SDK installed in your project

Sign up users

Email sign-up

Email sign-up requires a configured SMTP server to send verification emails. Set the following parameters in the Supabase Auth configuration on the Alibaba Cloud Management Console:

ParameterDescriptionExample
GOTRUE_SMTP_HOSTSMTP server addresssmtp.gmail.com
GOTRUE_SMTP_PORTSMTP server port587 or 465
GOTRUE_SMTP_USERSMTP username (usually an email address)noreply@example.com
GOTRUE_SMTP_PASSSMTP password or app-specific password
GOTRUE_SMTP_SENDER_NAMESender name displayed in outgoing emailsSupabase Support Team
GOTRUE_SMTP_ADMIN_EMAILAdministrator email address for system emails
GOTRUE_EXTERNAL_EMAIL_ENABLEDWhether to allow email-based sign-up and sign-in
GOTRUE_MAILER_AUTOCONFIRMWhether to skip email verification and auto-confirm users (useful in development)
GOTRUE_SITE_URLFrontend URL to redirect users to after operations such as password resethttps://your-app.com
API_EXTERNAL_URLExternally accessible API address, used for callbackshttps://api.your-app.com

After configuration, call:

const { data, error } = await supabase.auth.signUp({
  email: 'example@email.com',
  password: 'example-password',
})

Phone number sign-up

RDS Supabase supports two SMS methods: SMS webhook and Alibaba Cloud SMS. If both are configured, SMS webhook takes precedence.

Option 1: SMS webhook

SMS webhook routes verification messages through your own HTTPS endpoint. Set the following parameters in the Supabase Auth configuration on the Alibaba Cloud Management Console:

ParameterDescription
GOTRUE_HOOK_SEND_SMS_ENABLEDWhether to enable SMS sending via webhook
GOTRUE_HOOK_SEND_SMS_URIHTTPS endpoint that receives SMS send requests
GOTRUE_HOOK_SEND_SMS_SECRETSWebhook signing secret; must be a Base64-encoded string starting with v1,whsec_
GOTRUE_SMS_AUTOCONFIRMWhether to auto-confirm the one-time password (OTP). Set to false to require verification.
GOTRUE_SMS_OTP_EXPOTP validity period in seconds (for example, 60)

Option 2: Alibaba Cloud SMS

Alibaba Cloud SMS routes verification messages through Alibaba Cloud SMS service. Before configuring, make sure your AccessKey pair has the AliyunDysmsFullAccess and AliyunDypnsFullAccess permissions, and that you have a configured SMS signature and template.

Set the following parameters in the Supabase Auth configuration on the Alibaba Cloud Management Console:

ParameterDescriptionExample
GOTRUE_SMS_PROVIDERSMS provideraliyun
GOTRUE_SMS_ALIYUN_ACCESS_KEY_IDAlibaba Cloud AccessKey ID
GOTRUE_SMS_ALIYUN_ACCESS_KEY_SECRETAlibaba Cloud AccessKey secret
GOTRUE_SMS_ALIYUN_REGION_IDRegion of the Alibaba Cloud SMS servicecn-beijing
GOTRUE_SMS_ALIYUN_SIGN_NAMESMS signature nameSutong Internet Captcha.
GOTRUE_SMS_ALIYUN_TEMPLATE_CODESMS template code100001
GOTRUE_SMS_ALIYUN_IS_TESTSet to true to use the default test signature and template from the Alibaba Cloud SMS console. Omit or set to false if using your own signature and template.true
GOTRUE_SMS_AUTOCONFIRMWhether to auto-confirm the OTP. Set to false to require verification.false
GOTRUE_SMS_OTP_EXPOTP validity period in seconds60

After configuring either method, call:

const { data, error } = await supabase.auth.signUp({
  phone: '1381111****',
  password: 'example-password',
  options: {
    channel: 'sms'
  }
})

OAuth sign-up

RDS Supabase supports Alipay, WeChat, Google, and GitHub as OAuth providers. Each provider requires four parameters in the Supabase Auth configuration on the Alibaba Cloud Management Console:

ParameterDescription
GOTRUE_EXTERNAL_{PROVIDER}_ENABLEDWhether to enable the provider
GOTRUE_EXTERNAL_{PROVIDER}_CLIENT_IDOAuth client ID (AppID for Alipay and WeChat; client ID for Google and GitHub)
GOTRUE_EXTERNAL_{PROVIDER}_SECRETOAuth client secret (AppSecret for Alipay and WeChat; client secret for Google and GitHub)
GOTRUE_EXTERNAL_{PROVIDER}_REDIRECT_URIAuthorization callback URL. Format: http(s)://your-supabase-url/auth/v1/callback

Replace {PROVIDER} with ALIPAY, WECHAT, GOOGLE, or GITHUB.

After configuring a provider, call:

const { data, error } = await supabase.auth.signInWithOAuth({
  provider: 'alipay',   // or 'wechat', 'google', 'github'
})

Sign in users

Sign in users with an email and password, a phone number and password, or an OAuth provider:

// Sign in with email
const { data, error } = await supabase.auth.signInWithPassword({
  email: 'example@email.com',
  password: 'example-password',
})

// Sign in with phone number
const { data, error } = await supabase.auth.signInWithPassword({
  phone: '+1381111****',
  password: 'some-password',
})

// Sign in with an OAuth provider
const { data, error } = await supabase.auth.signInWithOAuth({
  provider: 'provider_name'   // 'alipay', 'wechat', 'google', or 'github'
})

Update user information

The user must be signed in before calling updateUser(). Update their email or password as follows:

// Update email
const { data, error } = await supabase.auth.updateUser({
  email: 'new****@email.com'
})

// Update password
const { data, error } = await supabase.auth.updateUser({
  password: 'new password'
})

Sign out users

const { error } = await supabase.auth.signOut()

What's next