Implement SSO for the OpenWeb RN SDK

There are two types of SSO available: Generic SSO and SSO with JWT secret. Please contact your OpenWeb PSMPSM - Partner Success Manager to pick the best option for you.


📘

Tip

For more information about SSO authentication, read Implement single sign on.

You can also enable single sign on through one of our third-party SSO partners.

OpenWeb also allows your users to login with their Facebook, Google or Twitter accounts. If you are interested in this option, contact your PSM and ask about Social Login.


Generic SSO

  1. Authenticate a user with your backend. You can use your login UI by subscribing to startLoginFlow event.
const onStartLoginFlow = (event) => {
    ...
}
const subscription = SpotIMEventEmitter.addListener('startLoginFlow', onStartLoginFlow);

  1. Call startSSO function and get codeA.
  2. Send the codeA and all needed information to your backend system in order to get codeB.
  3. Call completeSSO with the codeB.
  4. Check success and error properties in the callback to ensure everything is okay.
// 2
SpotIMAPI.startSSO()
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.error(error);
    })

// 4
SpotIMAPI.completeSSO("<CODE_B>")
    .then(response => {
        console.log(response);
    })
    .catch(error => {
        console.error(error);
    })

SSO with JWT secret

  1. Authenticate a user with your backend.
  2. Call 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);
      })

Did this page help you?