Using App Trust in Your Application
Configure an attestation provider and service protection in the Console, then initialize App Trust on your application’s JavaScript client.
Set Up App Trust
The Oracle Backend with Supabase APIs Console lets you configure App Trust and select the services to protect for a specific application.
-
Each application lists the attestation providers available for that application, based on the platform type.
-
Each provider requires its own configuration.
Before you begin: Register your web application and obtain the provider’s site key and server credentials. Use the site key to initialize the SDK. Keep server credentials in the Console configuration.
Table 44-1 Web Provider Configuration
| Attestation Providers | Provider-Specific Configuration |
|---|---|
| hCaptcha - hcaptcha.com | Provider secret key |
| reCAPTCHA v3 - Google reCAPTCHA Admin Console | Provider secret key and score threshold |
| reCAPTCHA Enterprise - Google Cloud reCAPTCHA Enterprise | Provider API key, Google Cloud project ID, and score threshold |
| Cloudflare Turnstile - Cloudflare Turnstile | Provider secret key |
For every provider, configure allowed hostnames, token lifetime, and the services to protect. The reCAPTCHA Enterprise provider API key is separate from your application’s public API key.
About TTL
The time to live (TTL) controls the lifetime of the server-issued App Trust token. Select a positive value and a unit: Seconds, Minutes, or Days. This server-side lifetime is separate from the SDK’s token cache and does not schedule background refreshes.
About Score Thresholds
For reCAPTCHA v3 and Enterprise, configure a minimum accepted score from 0.0 to 1.0. Higher thresholds require a higher provider score for verification to pass.
Console Steps for Setting Up App Trust
For an application already in use, coordinate enabling service protection with deploying the configured SDK integration. Clients without valid App Trust tokens are rejected by protected services.
To configure App Trust for your web application:
-
Register a web app. To confirm that it is registered, open Project settings > Applications and select your app.
See Also: Adding Oracle Backend with Supabase APIs to Your Apps for more information about registering your app
-
In your project’s Console, open App Trust. If the introduction page appears, select Get started to view your applications.
Figure 44-1 Console: Get Started with App Trust

-
Find your application and select Edit (the pencil icon) to open its App Trust configuration.
Figure 44-2 Console: App Trust Applications

-
Turn on App Trust and select the Provider that matches your application’s site key.
-
Enter the provider-specific settings from Table 44-1. For reCAPTCHA Enterprise, enter the provider API key in App key and enter the Google Cloud Project ID.
Figure 44-3 Console: App Trust Provider Configuration

Description of the illustration app-trust-provider-configuration.png
-
In Allowed hostnames, enter the hostnames where your app runs, one per line. Enter hostnames without a scheme, port, path, or query string.
-
In Session timeout settings, enter the TTL and select its Units.
-
In Service protection scope, select the services to protect.
Figure 44-4 Console: App Trust Service Protection Scope

-
Select Save. Confirm that the application’s App Trust status is Enabled and that Protected services lists the services you selected.
App Trust enforcement applies to those services. Saving provider configuration with no protected services selected leaves ordinary service enforcement disabled.
Initialize App Trust
App Trust APIs are available through client.appTrust. Reuse the relational client created in Initialize the JavaScript SDK. Initialize App Trust once on that client before requesting a token or subscribing to token updates.
The individual snippets show the available methods. The complete example initializes App Trust once and uses all three methods.
The relational package exports these providers:
ReCaptchaV3ProviderReCaptchaEnterpriseProviderHCaptchaProviderTurnstileProvider
Use initialize(options) to initialize App Trust with a configured provider:
client.appTrust.initialize({ provider: new ReCaptchaV3Provider("SITE_KEY") });
Use getToken(forceRefresh?) to return a cached token or obtain a new token when forced:
const { token } = await client.appTrust.getToken(true);
Use onTokenChanged(listener) to subscribe to token updates. The method returns an unsubscribe function:
const unsubscribe = client.appTrust.onTokenChanged(() => {
console.log("App Trust token updated.");
});
The following example imports a provider, initializes App Trust, gets a token, observes token changes, and unsubscribes:
import { ReCaptchaV3Provider } from "@fusabase/fusabase-relational";
client.appTrust.initialize({
provider: new ReCaptchaV3Provider("SITE_KEY"),
});
try {
await client.appTrust.getToken();
} catch {
throw new Error("App Trust verification failed.");
}
const unsubscribe = client.appTrust.onTokenChanged(() => {
console.log("App Trust token updated.");
});
// When the subscription is no longer needed:
unsubscribe();
Replace SITE_KEY with the site key for the provider configured for this application. Initialize App Trust on the same application used for the protected requests.
Handle a token-acquisition failure in your application before making protected requests. The example reports a fixed message without logging token values or the provider response.
Use Cases
Use App Trust for these application patterns:
- Initialize the configured attestation provider before requesting or observing App Trust tokens.
- Retrieve the current token with
getToken(), or force retrieval of a new token withgetToken(true). - Subscribe to token changes with
onTokenChanged(listener), and call the returned function when the subscription is no longer needed. - Initialize App Trust on the same application before making MFA calls. Use the provider configured for that application.
- Configure and activate an App Trust provider before enabling MFA. An inactive provider keeps MFA inactive.
An API key or user access token alone cannot authorize MFA enrollment. App Trust validation is also required for MFA session creation and SMS challenge sending. Other MFA requests follow the configured service enforcement policy.
For MFA configuration, see Setting Up Multi-Factor Authentication.