Home
Understanding SSO Redirects

Understanding SSO Redirects

featureOS uses its own authentication mechanism to either log users in or create a user account. If you want to override this to use your own authentication system, you've come to the right place! We will redirect your customers to your application, where you will authenticate the user, create a SSO token and redirect them back to featureOS.

Prerequisite

Your server should be set up to authenticate users and generate SSO Tokens.

Instructions

  1. Setup an authentication page on your website – We will send all users who land on your featureOS page here to be authenticated. The user will then need to login to your website using your credentials.

  2. Send a request to your server to generate a single sign-on token – Once the user is logged in, generate an SSO token. Read more hereβ†’

  3. Redirect them back to featureOS – When we redirect users to your application, we'll include a redirect query parameter. You will need to send users back to us with both the redirect URL and SSO token in the query parameters, once they've been logged in.

Add the URL of your newly created page to the admin dashboard and follow the steps on-screen.

Snippet

Use the following snippet to redirect users back to featureOS. You will need to fill in the part that generates an SSO token.

function getQueryParameterByKey(key) { 
  var pairStrings = window.location.search.slice(1).split('&'); 
  var pairs = pairStrings.map(function(pair) { 
    return pair.split('='); 
}); 
 return pairs.reduce(function(value, pair) { 
    if (value) return value; 
    return pair[0] === key ? decodeURIComponent(pair[1]) : null; 
 }, null); 
} 

function getSSORedirectURL(ssoToken) { 
  var redirectURL = getQueryParameterByKey('redirect'); 
  var domain = getQueryParameterByKey('domain'); 
  if (redirectURL.indexOf('https://') !== 0 || !domain) { 
    return null; 
  } 

  return 'https://app.featureos.app/redirects/sso?domain=' + domain + '&ssoToken=' + ssoToken + '&redirect=' + redirectURL; 
} 

var redirectURL = getSSORedirectURL(ssoToken); 
if (redirectURL) { 
   window.location.assign(redirectURL); 
}

Note: If you had setup the return URL as app.hellonext.co, we will redirect to app.featureos.app

Also, here's the link to our repository for more information on SSO redirects. We've added code samples in the repository for your reference.

Need more help?

Reach out to our support at [email protected] or submit a request on our support board! πŸ˜ƒ

Swathy

Swathy