Redirect from SSO Login to specific screen based on user profile variable

Hi,
Would it be possible that from the SSO login screen, I could check to see if a person has a certain value in the admin column and then redirect them to different screens based on that value. I have an app where the admins aren’t going to be using the functionality at all as a regular user and it would be best if they were redirected straight to the screen holding the admin menu, rather than them having to login in go to the regular home screen and then from the hamburger menu select Admin Menu. The regular/non-Admin users would get redirected to the normal home screen.
Is there a way to do this?

Hi Catalina,

Yes you can do this with some javascript on the SSO login page. Provided your SSO is connected to your login data source via the “Additional profile data” setting. You can something like the following:

Fliplet.Hooks.on("login", function (formEntry) {
  return Fliplet.User.getCachedSession().then(function (session) {
    var user = _.get(session, "entries.dataSource.data");

    if (!user) {
      return; // user is not logged in
    }

    // contains all columns found on the connected dataSource entry
    console.log(user);
    //Change your condition here
    if (user.Admin === "Yes") {
      //Change your screen name here
      Fliplet.Navigate.screen("Admin menu");
    }
    //Change your condition here
    if (user.Admin === "No") {
      //Change your screen name here
      Fliplet.Navigate.screen("Home");
    }
  });
});

Thanks,
Deb