SSO Example Structure
This article is about implementing SSO for Emplifi Ratings & Reviews widgets. For implementing SSO for the Emplifi platform, see Single Sign-on (SSO).
This code snippet displays one possible way to structure the turnToConfig
for a SpeedFlex SSO implementation.
CODE
var turnToConfig = {
...
sso: {
userDataFn: function(contextObj) {
// Check the user's logged-in status.
// YOUR CODE HERE
// If the user is not logged in, provide a registration or login form.
// If the user is logged in, generate the userDataToken.
// YOUR CODE HERE
// Assign the token to use it in the ssoRegDone callback.
var userToken = // YOUR CODE HERE
// Make a callback to the Emplifi ssoRegDone function with the userDataToken.
TurnToCmd('ssoRegDone', { context: contextObj, userDataToken: userToken });
},
loggedInDataFn: function(contextObj){
// Example: Call an endpoint on your site that will provide the logged-in data
$.get( "user/sso/loggedInData", function( data ) {
// Callback to Emplifi with result.
TurnToCmd('loggedInDataFnDone', { context: contextObj, loggedInData: data });
});
},
logout: function () {
// Log out the currently logged-in user.
// YOUR CODE HERE
}
}
}