✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.
logoReclaim Protocol Docs
Reclaim InApp SDKsUsage

Overrides

Instructions on how to override the default configuration of Reclaim Protocol's InApp SDKs

Get Started

Many configurations in the InApp SDKs can be overridden. For example, a different attestor can be used, or we can update app info that appears in the verification flow.

Reclaim Protocol InApp SDK has some overrides which are restricted and require a capability access token. This can be made available upon request. Contact our team to discuss implementation details.

The setOverrides method allows you to customize various aspects of the Reclaim InApp SDK's behavior. This documentation covers all available override options and their usage.

Basic Usage

const reclaimVerification = new ReclaimVerification();
reclaimVerification.setOverrides({
  // override configurations
});

For example of how to use overrides, see:

Available Override Options

Provider Configuration

Configure custom provider settings:

provider: {
  // Custom provider JSON configuration
  // Useful for overriding default provider settings or testing with custom providers
  jsonString: await fetchProviderConfig()
}

or

provider: {
  // Custom provider JSON configuration
  // A url to a json file that contains the provider configuration
  url: 'https://api.example.org/some-api/providers/6d3f6753-7ee6-49ee-a545-62f1b1822ae5'
}
  • The JSON string or url must point to a valid provider configuration that follows the provider schema.

Provider Schema

The Schema of Reclaim HTTP Provider used by Reclaim Protocol's InApp SDKs

Examples of provider schema can be found as provider configurations in the https://api.reclaimprotocol.org/api/providers/${provider_id} http api. For example, Devtool's Http Api for Github Username Provider.

Note:

  • These examples have a different structure where the provider configuration is nested under a 'providers' key, rather than being the root object. Therefore, the https://api.reclaimprotocol.org/api/providers/${provider_id} http apis cannot be used as direct parameters for provider overrides by url in this SDK.
  • For use with jsonString, provider the value of the 'providers' key in the jsonString parameter.

Logging Configuration

Control SDK logging behavior:

logConsumer: {
  // Disable/enable telemetry collection
  canSdkCollectTelemetry: false,
  
  // Disable/enable SDK console logging
  canSdkPrintLogs: false,
  
  // Custom log handler function
  onLogs: (logJsonString, _) => {
    console.log(logJsonString);
  }
}

App Information

Customize the application's identity during claim creation:

appInfo: {
  // Custom application name
  appName: "Your App Name",
  
  // Custom application logo/image
  appImageUrl: "https://your-app-image-url.com/image.png"
}

Feature Options

Configure SDK behavior and features:

featureOptions: {
  // Cookie persistence configuration
  cookiePersist: null,
  
  // Enable/disable single reclaim request mode
  singleReclaimRequest: false,
  
  // Idle time threshold (in seconds) for manual verification trigger  (Default from reclaimprotocol.org: `2`)
  idleTimeThresholdForManualVerificationTrigger: 2,
  
  // Session timeout (in seconds) for manual verification trigger (Default from reclaimprotocol.org: `180`)
  sessionTimeoutForManualVerificationTrigger: 180,
  
  // Custom attestor browser RPC URL (Default from reclaimprotocol.org: `https://attestor.reclaimprotocol.org/browser-rpc`)
  attestorBrowserRpcUrl: 'https://attestor.reclaimprotocol.org/browser-rpc',
  
  // Enable/disable response redaction regex escaping by the app (Default from reclaimprotocol.org: `false`)
  isResponseRedactionRegexEscapingEnabled: false,
  // Whether AI Flow can be enabled by the SDK. (Default from reclaimprotocol.org: `false`)
  isAIFlowEnabled: false,
}

Setting all values to non-null values will prevent the SDK from fetching feature settings from reclaim protocol APIs server.

Session Management

Handle session-related events:

sessionManagement: {
  // Session logging handler
  onLog: (event) => {
    console.log(event);
  },
  
  // Session creation request handler
  // Return true to allow session creation
  // Returning false will cancel the session with session expired exception.
  onSessionCreateRequest: async (event) => {
    console.log(event);
    return true;
  },
  
  // Session update request handler
  // Return true to allow session update
  // Returning false will cancel the session with session expired exception.
  onSessionUpdateRequest: async (event) => {
    console.log(event);
    return true;
  }
}

Complete Example

Here's a full example showing all available override options:

reclaimVerification.setOverrides({
  provider: {
    jsonString: await fetchProviderConfig()
  },
  logConsumer: {
    canSdkCollectTelemetry: false,
    canSdkPrintLogs: false,
    onLogs: (logJsonString, _) => {
      console.log({ "reclaim.logs": logJsonString });
    }
  },
  appInfo: {
    appName: "Custom App Name",
    appImageUrl: "https://placehold.co/400x400/png"
  },
  featureOptions: {
    cookiePersist: null,
    singleReclaimRequest: false,
    idleTimeThresholdForManualVerificationTrigger: 2,
    sessionTimeoutForManualVerificationTrigger: 180,
    attestorBrowserRpcUrl: 'https://attestor.reclaimprotocol.org/browser-rpc',
    isResponseRedactionRegexEscapingEnabled: false,
    isAIFlowEnabled: false
  },
  sessionManagement: {
    onLog: (event) => {
      console.log({ "reclaim.session.log": event });
    },
    onSessionCreateRequest: async (event) => {
      console.log({ "reclaim.session.createRequest": event });
      return true;
    },
    onSessionUpdateRequest: async (event) => {
      console.log({ "reclaim.session.updateRequest": event });
      return true;
    }
  }
});

Best Practices

  1. Set overrides before calling startVerification
  2. Consider setting overrides only once.
  3. Handle all session management events appropriately.
  4. Use appropriate timeout values for your use case
  5. Test thoroughly when modifying default behaviors

Notes

  • All override options are optional
  • Overrides persist until explicitly changed or cleared with clearAllOverrides
  • Some features may require specific override combinations to work properly
  • Overriding all options will cause the app to not use any reclaim protocol APIs.

On this page