Leveraging User.loggedIn in Descope Flows

In your flow you can use the user.loggedIn value as a tool to enhance your authentication flows. This value will rely on refresh tokens, present or not, in the client to be able to check if a user is already logged in or not. This feature allows you to dynamically adjust user experience based on their authentication status.

Below are some example use cases for this specific conditional statement.

Use Cases for user.loggedIn

1. Bypassing the Login Flow

In scenarios where users are already authenticated, you might want to bypass the login flow entirely and directly navigate them to a post-login page or dashboard.

flow conditional action

if logged in, end the flow

This approach ensures a seamless experience for returning users.

2. Role Check Before Running SSO Config Flow

For applications implementing Single Sign-On (SSO) with SAML, you may need to verify if the authenticated user has the necessary role before allowing them to configure SAML settings. This ensures that only authorized users can access sensitive SSO Configuration settings.

3. Securing Internal Pages and Updating User Details

Protecting internal pages of a site and providing flows for users to update their details can also be managed using user.loggedIn. This logic ensures that only authenticated users can access internal pages or update their personal details, enhancing the security and integrity of user data.

For further assistance or queries, feel free to reach out to our support team.