Authenticating Application Users
Application users (app users) are the people or systems that sign in to your app and call Oracle Backend with Supabase APIs services through the JavaScript SDK or REST APIs. This chapter explains what an app user is, how sign-in works, and how tokens and user state behave so you can design predictable Auth flows.
Happy path: Enable a sign-in method in the Console, call the SDK sign-in method in your app, and listen for Auth state changes to keep your UI in sync. For a basic example, see Getting started with authentication.
Authentication answers two questions for every request:
-
Who is the caller?
-
Is the caller signed in?
Oracle Backend with Supabase APIs uses authentication tokens to identify the signed-in user and to keep requests tied to that user across SDK calls.
App Users
An app user represents a user account that has signed up for an app in your project. Apps in the same project share a single Auth user database, so a user can sign in to multiple apps in that project with the same account.
Basic Properties
Each registered user has a fixed set of properties stored in the Auth service:
-
Unique user ID
-
Display name
-
Email address (also the username)
-
Sign-in method used during registration (for example, email/password, Google, Facebook)
-
Account creation time
You cannot add arbitrary properties to the user object itself. Store app-specific data in your database and reference it by user ID.
Sign-In Methods
Oracle Backend with Supabase APIs supports multiple sign-in methods, so you can match your app’s needs and your users’ identity provider:
-
Email/password (BASIC)
-
LDAP
-
Social identity providers (Google, Facebook, GitHub)
-
Enterprise identity providers OpenID Connect, Security Assertion Markup Language, and Oracle IAM Domains (OIDC, SAML, and Oracle IAM Domains)
Oracle Backend with Supabase APIs integrates federated identity flows. It does not manage the identity provider login UI, so your app redirects to the provider for sign-in and returns with credentials.
For details on BASIC and LDAP, see Authentication methods: BASIC and LDAP.
Authentication Flow
This is the end-to-end flow that Oracle Backend with Supabase APIs manages when a user signs in, providing insight into the behind-the-scenes process.
-
The user signs in through the SDK using a supported method.
-
Oracle Backend with Supabase APIs validates the credentials.
-
The service issues an access token and a refresh token.
-
The SDK stores the tokens and attaches the access token to requests. You do not need to manage tokens directly unless you are calling the REST APIs.
-
When the access token expires, the SDK uses the refresh token to get a new access token.
-
On successful sign-out, the SDK revokes the refresh token and clears local state. Handle sign-out errors before treating the operation as complete.
Current User and Auth Listeners
When a user signs in, the JavaScript SDK sets the current user and keeps that state based on your persistence configuration. Auth persistence supports memory, browser local storage, and browser session storage.
The relational client’s onAuthStateChange() callback reports the initial session, sign-in, and sign-out. It doesn’t emit a token-refresh event. See Persistence Settings.
Application User Self-service
The JavaScript SDK provides user-facing actions you can surface in your app:
-
Update profile fields such as
displayName. -
Reset password.
-
Verify email address.
Use these methods to build self-service flows inside your app, such as a profile page or account settings screen. It keeps users in control of their accounts and reduces the need for manual administrator support.
Email Verification and Password Reset
Email verification and password reset help you build a smoother onboarding and recovery experience. These features are available for BASIC and LDAP users and require SMTP configuration.
SMTP Configuration
Before you turn the email verification and password reset features on, make sure you have access to an SMTP server. Oracle Backend with Supabase APIs connects to your SMTP server to send emails; it does not provide one. Gather the SMTP host, port, sender email address, and credentials so you can enter them in the Console. If you do not have an SMTP server, use your organization’s mail service or a third-party SMTP provider.
In the Console, SMTP configuration is under Project settings > SMTP settings. Follow Configuring SMTP for Email Verification and Password Reset.
Email Verification
Email verification confirms that the user’s email address is valid. This helps you detect typos and prevents users from signing up with addresses they do not control.
How it works:
-
After sign-up, Oracle Backend with Supabase APIs generates a verification code.
-
The user receives an email with a verification link.
-
When the link is used,
email_verifiedbecomes true. The account remains active regardless of the verification status.
Password Reset
Password reset lets users recover access when they forget their password, so you do not need to handle manual resets.
How it works:
-
The user requests a reset.
-
Oracle Backend with Supabase APIs generates a reset code.
-
The user receives an email with a reset link.
-
The user submits the code and a new password.
-
The password is updated securely.
Password reset is not supported for social login users. It is supported for IDCS users.
Auth Tokens
Oracle Backend with Supabase APIs issues tokens when users sign in, and the JavaScript SDK attaches the right token to each request for you. You usually do not need to handle tokens directly unless you are calling the REST APIs or troubleshooting a sign-in issue.
You can encounter these token types:
-
Oracle Backend with Supabase APIs Auth token: The token returned after successful app-user sign-in. The
scopeindicates which services are allowed, such asdatabase,auth, andstorage. -
Oracle IDCS token: When Oracle Backend with Supabase APIs uses Oracle IDCS for authentication, the SDK exchanges a valid IDCS access token for an Oracle Backend with Supabase APIs Auth token so services can recognize the user. With External IDCS, service requests use the end-user access token directly instead of exchanging it for an Oracle Backend with Supabase APIs Auth token.
Auth Token Example
{
"user_displayname": "Scott Scott",
"user_id": "68AB1C234D9FA873E083F283695E41B0",
"email_verified": "true",
"creation_time": "2024-07-20T10:25:36.789123Z",
"claim": null,
"idp_type": "BASE",
"sub": "scott@example.com",
"iss": "baas_onprem#68AB1C2DE7C3D871E083F283695E54A2",
"iat": 1721462736,
"exp": 1721466337,
"idp_name": "UserNamePassword",
"scope": "database auth storage",
"aud": "68AB1C2A90EF1872E083F283695E51D3",
"uid": "68AB1C234D9FA873E083F283695E41B0",
"token": {
"email": "scott@example.com",
"email_verified": "true",
"sub": "scott@example.com",
"name": "Scott Scott"
}
}
Auth Token Fields
-
user_displayname: User display name shown in apps or UIs. -
user_idanduid: Unique user identifier. -
email_verified: Whether the email address is verified. -
creation_time: Timestamp when the account was created. -
idp_type: Identity provider type, such asBASE,LDAP, orIDCS. -
idp_name: Human-readable provider name, such asUserNamePassword,google, orfacebook. -
sub: Subject identifier, often the user’s email. -
iss: Token issuer. -
iat: Issued-at timestamp (Unix epoch). -
exp: Expiration timestamp (Unix epoch). -
scope: Services the token allows, such asdatabase. -
aud: Audience identifier. -
token: Nested object containing email, subject, and name.
Managing Application Users
Use the Console to view users and inspect provider and verification status. This is useful when you are testing sign-in flows or supporting users.
Available administration operations depend on the authentication backend. With External IDCS, removing a user removes project-group membership; it does not delete the user from the IAM identity domain. You cannot disable External IDCS users through the project administration calls. See External IDCS Authentication Setup.
JSON Web Key
Oracle Backend with Supabase APIs uses JSON Web Tokens (JWTs) to identify signed-in users. For project tokens signed with RS256, the project exposes an RSA public verification key through its JSON Web Key (JWK) endpoint. HS256 is also supported; the RSA key endpoint does not verify HS256 tokens. IDCS and External IDCS use their identity domain’s signing keys for identity-domain tokens.
For RS256 project tokens, retrieve the public verification key from the JWK endpoint for use in application middleware or other token verification components. The endpoint returns a JSON Web Key Set containing the project’s RSA public key. Configure token verifiers to refresh cached keys when the signing key changes.
Key Rotation
A project owner can use Rotate Key in the Console to replace the project’s signing key. Key rotation can be performed:
-
As part of regular security and compliance practices.
-
If the private signing key is suspected to have been compromised or leaked.
After rotation, retrieve the public key from the endpoint again and refresh cached keys used by your token verifiers.
JWK Endpoint
Use the following endpoint to retrieve the JSON Web Key Set for an RS256 project signing key:
HOST/ords/SCHEMA_ALIAS/_/baas-services/idm/signingKey/PROJECT_ID/jwk
Replace HOST with the ORDS origin, SCHEMA_ALIAS with the schema alias, and PROJECT_ID with the project ID.