Single Sign-on for React Native

Implement SSO for the OpenWeb React Native SDK

There are two types of SSO available: Standard and third-party single sign-on. Please contact your OpenWeb PSM if you are unsure which implementation method applies to you.



Implementation Options

Standard

  1. Authenticate a user with your backend user management system.
const onStartLoginFlow = (event) => {
    ...
}
const subscription = SpotIMEventEmitter.addListener('startLoginFlow', onStartLoginFlow);

  1. Call startSSO function and get codeA.
SpotIMAPI.startSSO()
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.error(error);
    })

  1. Make a GET /sso/v1/register-user call to OpenWeb. The API call must include your secret access token (access_token), the session ID generated after initiating the SSO session (codeA), and required user details from your backend user management system (primary_key, user_name). Each of these parameters is defined in Add user information.

  1. Call completeSSO with the codeB.
SpotIMAPI.completeSSO("<CODE_B>")
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.error(error);
    })

  1. Check success and error properties in the callback to ensure everything is okay.

Third-party single sign-on

  1. Authenticate a user with your third-party user management vendor.
  2. Call the sso(JWTSecret) function with a user JWT secret.

If there’s no error in the callback and response?.success is true, the authentication process finished successfully.

SpotIMAPI.sso("<SECRET_JWT>")
    .then(response => {
        console.log(response);
      })
    .catch(error => {
        console.error(error);
      })