Single Sign On (SSO) enables your users to auto-login on Arena.im when they're already logged into your online portal. Your system will need to let Arena.im know which user is currently logged into your site, in a secure manner.

To accomplish this, our widgets provides a set of basic methods and handlers, outlined below:

Notes:

  • SSO implementation only works when widgets are embedded using JavaScript. It won't work for iFrame embeds.

  • This feature is available only for Enterprise plans, please contact your Account Manager so they can enable it for you.

Step 1: Wait for the SSO to be ready

You must wait for the Arena SSO to be ready using the listener below. After the API is ready, it will call the startArenaSSO function.

if (window.arenaSSO) { 
startArenaSSO();
} else {
document.addEventListener(
'arena-im-api-ready',
startArenaSSO,
false
);
}

Step 2: Initialize the SSO

To initialize the Arena SSO, you have to define the startArenaSSO function and within that function, a call to window.arenaSSO.initialize method. In the initialize function you have to call your sign in and sign out respective functions. Also, you can provide the logged user information by calling the Arena SSO authenticate method, as in the example below:

function startArenaSSO() {
window.arenaSSO.initialize({
// Called when the user clicks on sign in in an Arena Widget
signIn: () => { // call your sign in function },
// Called when the user clicks on sign out in an Arena Widget
signOut: () => { // call your sign out function },
});

// Provide the current user info to Arena SSO
window.arenaSSO.authenticate({
id: "2345",
email: "[email protected]",
picture: "https://randomuser.me/api/portraits/women/12.jpg",
name: "Kristin Mckinney",
});
}

Step 3: Call Authenticate and Sign out Methods

On your website, when you finish authenticating the user, you have to inform the user's information to the Arena SSO. Check the example below:

// Provide the logged user to Arena SSO
window.arenaSSO.authenticate({
id: "2345",
email: "[email protected]",
picture: "https://randomuser.me/api/portraits/women/12.jpg",
name: "Kristin Mckinney"
});

Arena SSO will create the user profile if it's the first time or just return their information if it's not the first time.

And when your user sign out, you have to call the Arena SSO method signOut, as in the example bellow.

// Sign out the user on Arena SSO
window.arenaSSO.signOut();

That's all that needs to be done and as always let us know if you have any questions or suggestions regarding the Single Sign On integration.

Did this answer your question?