Navigation

Handle events & actions

Once Rupt is integrated into your website, it maps a user journey to a set of events. These events are emitted by the SDK and can be listened to by your application. Here is a list of events and user actions that can be listened to:

EventInitiatorHandler typeDescription
on_limit_exceededSDKfunctionCalled when the user exceeds the device limit.
on_challengeSDKfunctionCalled when Rupt determines that the user should be challenged (more about challenges here).
on_current_device_logoutSDKfunctionCalled right before the current device should be logged out.
redirect_urls.new_account_urlUserurl string(required) A URL to redirect the user to if they want to stop account sharing and create a new account.
redirect_urls.logout_urlUserurl string(required) A URL to redirect the user to if they choose to logout or if they are kicked out by a verified owner.
redirect_urls.success_urlSDKurl string(optional) A URL to redirect the user to if they are successfully verified and are within the device limit.
redirect_urls.suspended_urlSDKurl string(optional) A URL to redirect the user to if they are suspended.
redirect_urls.upgrade_urlSDKurl string(optional) A URL to redirect the user to if they choose to upgrade and skip a free trial (when challenged for multiple trials)
await Rupt.attach({
  client_id: `your_api_client_id`,
  account: `user_account_id`,
  on_challenge: () => {
    /* optional */
  },
  on_limit_exceeded: ({ attached_devices }) => {
    /* optional */
  },
  on_current_device_logout: ({ challenge }) => {
    /* optional */
  },
  redirect_urls: {
    new_account_url: `https://yourwebsite.com/new-account`, // required
    logout_url: `https://yourwebsite.com/logout`, // required
    success_url: `https://yourwebsite.com/success`, // optional
    suspended_url: `https://yourwebsite.com/suspended`, // optional
    upgrade_url: `https://yourwebsite.com/upgrade`, // optional
  },
});

on_limit_exceeded

This is called when the user exceeds the device limit. This is an informational callback and does not affect the user journey. You can use this callback to do any internal work or for custom conversion journeys.

on_challenge

This is called when Rupt determines that the user should be challenged. This can happen if the account has too many people or too many devices attached to it. You can use this callback to do any internal work before the user is redirect to the challenge page. If this function returns false, the user will not be redirected to the challenge page.

on_current_device_logout

This is called right before a device should be logged out. This logout action can be a result of a user kicking out this devices via a challenge, or simply a manual .detach call. This function provides a challenge parameter to distinguish between the two cases. You can use this callback to do any internal work before the user is redirect to the logout page (or log them out manually). If this function returns false, the user will not be redirected to the logout page.

redirect_urls

These are the URLs that Rupt will redirect the user to when certain events happen. Some URLs are required for a complete experience. Others are optional and can be used to customize the user journey.

redirect_urls.new_account_url

This is the URL that Rupt will redirect the user to if they want to stop account sharing and create a new account. This URL is required.

redirect_urls.logout_url

This is the URL that Rupt will redirect the user to if they choose to logout or if they are kicked out by a verified owner. This URL is required. If the logout is triggered from a challenge, the ID of the challenge will be appended to the logout url.

redirect_urls.success_url

This is the URL that Rupt will redirect the user to if they are successfully verified and are within the device limit. This URL is optional. If this URL is not provided, Rupt will redirect the user to the url they were on before they were redirected to the Rupt challenge page.

redirect_urls.suspended_url

This is the URL that Rupt will redirect the user to if they are suspended. This URL is optional. If this URL is not provided, Rupt will redirect the user to the a hosted & branded suspended page. You can learn more about suspended pages here.

redirect_urls.upgrade_url

A URL to redirect the user to if they choose to upgrade. This URL is optional. If this URL is not provided, Rupt will not show an account upgrade redirect button on the Rupt challenge page.