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
- 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);
- Call
startSSO
function and getcodeA
. - Send the
codeA
and all needed information to your backend system in order to getcodeB
. - Call
completeSSO
with thecodeB
. - Check
success
anderror
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
- Authenticate a user with your backend.
- 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);
})
Updated 7 months ago
Did this page help you?