Skip to main content
Skip table of contents

SSO Example Structure

This code snippet displays one possible way to structure the turnToConfig for a SpeedFlex SSO implementation.

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
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.