Skip to main contentArrow Right
Blog header graphic labeled "Developer Guide" showing the Descope logo mark next to the Streamlit logo, a red paper boat shape. Below the logos, large text reads "Auth & SSO for Streamlit."

Table of Contents

Summarize with AI

Don't have the time to read the entire post? Our human writers will be sad, but we understand. Summarize the post with your preferred LLM here instead.

This tutorial was written by Gideon Idoko, a solution-driven software engineer and technical writer. Connect with him on his website or X to see more of his work!


Streamlit makes it simple to turn Python scripts into shareable data apps. As these apps move from personal notebooks to team and company use, adding secure authentication and single sign-on (SSO) becomes essential. Authentication protects sensitive data and gates features by user identity. SSO lets people sign in once and move across apps without repeating logins.

In this tutorial, you’ll use Descope, a drag & drop CIAM platform to add:

Prerequisites

Before diving into the integration process, ensure you understand the basics of Python and Streamlit. You also need a Descope account, but don’t worry if you don’t have one yet—you’ll learn how to set one up shortly. The free tier will be sufficient for you to follow along.

Creating a project in Descope

The first step is to connect your Streamlit app with Descope by creating a project in the Descope console.

  1. Go to the Descope sign-up page and register for a free account (or log in if you already have one).

  2. From the top-left menu in the console, select + Project to create a new project.

Your project dashboard is the hub where you’ll:

  • Create and manage projects

  • Assign user roles

  • Configure authentication flows

  • Adjust project-level settings

In Settings > Project, you’ll see your Project ID. This is a unique identifier that links your Streamlit app to Descope.

Descope Console Project settings page for a project named "delicious-peach-turing," with the General tab selected next to a JWT Templates tab. The General section shows a Project Name field containing "delicious-peach-turing" and a Project ID field whose value is blurred, with a copy button. Under Environment Settings ("Define if the project will be used for production or internal matters."), Non-Production is selected instead of Production. The Domain section ("Configure the URL which your application resides on, and configure a custom domain.") has an empty App URL field and a Configure Custom Domain option. The Security section shows an empty Approved Domains field ("These domains apply to the authentication behavior during the redirection process") and a warning: "For security reasons we strongly recommend limiting authentication processes to specific domains. Leaving this empty is considered a security risk as it allows access to any domain." The left navigation lists Home, Getting Started, Authentication Methods, Flows, Widgets, Styles, Localization, Connectors, Users, Access Keys, Tenants, Applications, Authorization, Audit and Troubleshoot, Project (selected), and Company.
Fig: Descope console project settings

Best practice: Never paste this ID directly into your code. Instead, store it securely as an environment variable or in .streamlit/secrets.toml. Later in this tutorial, we’ll show you how to use it safely inside your app.

Creating a Streamlit app

With your Descope project set up, let’s move to the Streamlit side. We’ll start with a bare-bones app and then integrate authentication step by step.

  • Create a new directory for your app. Optionally, set up a Python virtual environment inside it.

  • Install Streamlit with the following command:

pip install streamlit
  • In the new directory, create a file called app.py and paste the following code:

import streamlit as st

st.title("Demo App")
st.write("This is a demo app with Descope-powered authentication and SSO")
  • You need a project ID to initialize Descope, so copy yours from the console settings, create a .streamlit/secrets.toml file in the root directory of your app, and include the project ID, like this:

You should get an output like this:

Streamlit app running in a browser at localhost:8501. The page shows the heading "Demo App" and the text "This is a demo app with Descope-powered authentication and SSO." A Deploy button and a menu icon appear in the top right corner.
Fig: Simple Streamlit app

Implementing OAuth social logins in Steamlit

Before diving into enterprise SSO, let’s start with something many users expect out of the box: social logins. OAuth providers like Google or GitHub let people sign in with accounts they already trust. This removes friction during signup and reduces the need to manage yet another password.

By adding OAuth, your Streamlit app instantly feels more professional and user-friendly—and when paired with SSO later, you’ll cover both casual and enterprise login scenarios.

Configuring Descope as a federated identity provider for Streamlit

In this section, we walk you through setting up Descope as a federated identity provider (IdP) for Streamlit and seamlessly integrating Google login with the application you created earlier.

In the Descope console, go to: Build > Authentication Methods > Social Login (OAuth/OIDC)

Here you’ll see a full list of supported providers. Select Google for this example:

Descope Console for the project "delicious-peach-turing" with three numbered callouts. Callout 1 marks "Authentication Methods" in the left navigation, which also lists Home, Getting Started, Flows, Widgets, Styles, Localization, Connectors, Users, Access Keys, Tenants, Applications, Authorization, and Audit and Troubleshoot. Callout 2 marks "Social Login (OAuth / OIDC)" in the Authentication Methods list, alongside the other methods: one-time password, magic link, Enchanted Link, embedded link, nOTP (WhatsApp), SSO, passkeys (WebAuthn), authenticator apps (TOTP), and passwords. The Social Login (OAuth / OIDC) panel reads "Validate a user using a familiar third-party identity provider. Learn More" and has the "Enable method in API and SDK" toggle switched on, a Search field, and an "Add custom provider" button. Provider cards, each labeled "Descope Authentication Account," are Apple, Discord, Facebook, Github, Gitlab, Google, Linkedin, Microsoft, and Slack. Callout 3 marks the Google card. Save and Cancel buttons sit at the bottom.
Fig: Select Google social login

Note: The Descope console provides an authentication account for all common social logins. There’s also an option to specify a different account for authentication if you prefer.

Next, configure the redirect URL. This is the location users will return to after completing authentication. Since we’re working locally, set it to your app’s address, http://localhost:8501, in the configuration provided, like this:

Descope Console in the project "DemoProject," on Authentication Methods with "Social Login (OAuth / OIDC)" selected and the Google provider settings open. The "Descope" account option is selected instead of "Use my own account." Scopes are openid, email, and profile. Allowed Grant Types is "Authorization code." The "Use PKCE" toggle is off. A Prompt section reads "Specify how the Authorization Server prompts the end user for re-authentication and consent. Learn More" above an empty Prompt dropdown. The User Attribute Mapping section reads "Click the add button to map user attributes from the third-party identity provider to custom attributes in Descope," with the "Update user information upon successful login" toggle on and an "Add user attribute mapping" option. Under Advanced, a red arrow points to the Redirect URL field, which contains "http://localhost:8501". Below it, "Email address handling" reads "Decide if the email address returned from the provider should be treated as a login ID as well." Save and Cancel buttons sit at the bottom.
Fig: Add redirect

Remember, you can also provide the redirect URL programmatically in your Streamlit code for added flexibility later.

Integrating Descope with your Streamlit app as its OAuth provider

Now let’s wire your app to Descope so it can trigger the OAuth login flow and handle the response.

  • Install its Python SDK to facilitate the interaction:

pip install descope
  • You need a project ID to initialize Descope, so copy yours from the console settings, create a .streamlit/secrets.toml file in the root directory of your app, and include the project ID, like this:

DESCOPE_PROJECT_ID = "XXXXX"
  • Initialize Descope in your app:

import streamlit as st
from descope.descope_client import DescopeClient

DESCOPE_PROJECT_ID = str(st.secrets.get("DESCOPE_PROJECT_ID"))

descope_client = DescopeClient(project_id=DESCOPE_PROJECT_ID)

st.title("Demo App")
st.write("This is a demo app with Descope-powered authentication and SSO")
  • Create a “Sign in with Google” button that launches the OAuth flow using the descope_client.oauth.start() method:

# … collapsed repeated code
descope_client = DescopeClient(project_id=DESCOPE_PROJECT_ID)

st.warning("You're not logged in, pls login")
with st.container(border=True):
    if st.button("Sign In with Google", use_container_width=True):
        oauth_response = descope_client.oauth.start(
            provider="google", return_url="http://localhost:8501"
        )
        url = oauth_response["url"]
        # Redirect to Google
        st.markdown(
            f'<meta http-equiv="refresh" content="0; url={url}">',
            unsafe_allow_html=True,
        )

st.title("Demo App")
# …
  • When clicked, this button triggers the OAuth flow. Descope generates a Google sign-in URL and redirects the user there.

    Your Streamlit app should now look like this:

Streamlit app running in a browser at localhost:8501, in its logged-out state. A yellow notice reads "You're not logged in, pls login". Below it is a single full-width button labeled "Sign In with Google". Under the button, the heading "Demo App" is followed by the line "This is a demo app with Descope-powered authentication and SSO". The Streamlit toolbar at the top right shows a Deploy option and a menu icon.
Fig: Streamlit app with a Google button

Click the Sign In with Google button, and you are redirected back to the app with a code query parameter after successfully authenticating via Google. This flow is known as the authorization code flow. In the next step, you’ll exchange the returned code for a token that authenticates your users.

You can use the Streamlit st.query_params method to capture the code from the URL, and the descope_client.sso.exchange_token() method to trade it for a token. Along with the token, Descope also provides user data and a refresh token that renews the short-lived session token. By storing this information in Streamlit’s session_state, you can persist authentication details across multiple runs and conditionally display your app’s content only when a valid token is present.

To persist tokens and user data, update your code as follows:

import streamlit as st
from descope.descope_client import DescopeClient
from descope.exceptions import AuthException

DESCOPE_PROJECT_ID = str(st.secrets.get("DESCOPE_PROJECT_ID"))

descope_client = DescopeClient(project_id=DESCOPE_PROJECT_ID)


if "token" not in st.session_state:
    # User is not logged in
    if "code" in st.query_params:
        # Handle possible login
        code = st.query_params["code"]
        # Reset URL state
        st.query_params.clear()
        try:
            # Exchange code
            with st.spinner("Loading..."):
                jwt_response = descope_client.sso.exchange_token(code)
            st.session_state["token"] = jwt_response["sessionToken"].get("jwt")
            st.session_state["refresh_token"] = jwt_response["refreshSessionToken"].get(
                "jwt"
            )
            st.session_state["user"] = jwt_response["user"]
            st.rerun()
        except AuthException:
            st.error("Login failed!")
    st.warning("You're not logged in, pls login")
    with st.container(border=True):
        if st.button("Sign In with Google", use_container_width=True):
            oauth_response = descope_client.oauth.start(
                provider="google", return_url="http://localhost:8501"
            )
            url = oauth_response["url"]
            # Redirect to Google
            st.markdown(
                f'<meta http-equiv="refresh" content="0; url={url}">',
                unsafe_allow_html=True,
            )
else:
    # User is logged in
    try:
        with st.spinner("Loading..."):
            jwt_response = descope_client.validate_and_refresh_session(
                st.session_state.token, st.session_state.refresh_token
            )
            # Persist refreshed token
            st.session_state["token"] = jwt_response["sessionToken"].get("jwt")
        st.title("Demo App")
        st.write("This is a demo app with Descope-powered authentication and SSO")
        st.subheader("Welcome! you're logged in")
        if "user" in st.session_state:
            user = st.session_state.user
            st.write("Name: " + user["name"])
            st.write("Email: " + user["email"])
        if st.button("Logout"):
            # Log out user
            del st.session_state.token
            st.rerun()
    except AuthException:
        # Log out user
        del st.session_state.token
        st.rerun()

At this point, your app only displays content when a user is logged in. You’ve successfully implemented Streamlit authentication with OAuth, laying the foundation for full Streamlit SSO with enterprise providers like Okta in the next section.

Streamlit app running in a browser at localhost:8501, in its logged-in state. The heading "Demo App" is followed by the line "This is a demo app with Descope-powered authentication and SSO". A subheading reads "Welcome! you're logged in". Below it are the user's profile details, "Name: Gideon Idoko" and "Email: iamgideonidoko@gmail.com" (shown as a link), and a "Logout" button. The Streamlit toolbar at the top right shows a Deploy option and a menu icon.
Fig: Authenticated Streamlit app

Implementing SAML SSO in Streamlit

The Security Assertion Markup Language (SAML) is an open standard for exchanging authentication and authorization data between an IdP and a service provider (SP). In this setup, platforms like Okta act as the IdP, while your Streamlit app functions as the SP.

SAML SSO allows users to access multiple applications with a single login. This is especially valuable for organizations managing many apps, since it reduces friction for users and administrators alike.

In the SSO model, organizations that use your Streamlit app are represented as tenants. Each tenant groups users, permissions, and related configurations, giving you a way to handle enterprise customers with their own SSO setup.

Configuring Okta as the IdP and Descope as the SP

For this example, you’ll use Okta as the IdP while Descope acts as the SP that integrates with your Streamlit app.

  • In the Descope console, create a new tenant: Go to the Tenants page and click + Tenant.

Descope Console Tenants page for the project "delicious-peach-turing," with four numbered callouts showing how to create a tenant. Callout 1 marks "Tenants" in the left navigation. Callout 2 marks the "+ Tenant" button at the top right of the page. A "Create Tenant" dialog is open in the center: callout 3 marks the required "Tenant name" field, filled in with "Tenant One," above an empty "(Optional) Tenant ID" field. Callout 4 marks the "Create" button, next to "Cancel." Behind the dialog, the page reads "If your application is B2B, each customer/account is a Descope tenant. You can create tenants and configure their SSO. Learn More," with Tenants and Custom Attributes tabs, a Search field, table columns including Name and Created Time, and the empty-state message "No tenants found."
Fig: Create a Descope tenant
  • In the tenant Authentication Methods section, choose the SAML protocol. Enter your email domain in the SSO Domains field under Tenant Details.

Descope Console tenant settings for "Tenant One," reached through the breadcrumb delicious-peach-turing / Tenants / Tenant One, with a "Back to Tenants" link. The tenant's left navigation lists Authentication Methods (selected) under Build, Authorization under Manage, and Tenant Settings under Settings. In the method list, SSO is selected above Passwords. The SSO panel shows "Authentication Protocol" with three radio options, None, SAML, and OIDC, and SAML is selected. A Tenant Details card contains "SSO Domains," described as "The below domains are used to determine which SSO configuration to load once a user chooses to authenticate using SSO," with an empty SSO Domains field. Below it, "JIT Provisioning" reads "Automatic user creation and updates. When disabled, provisioning and mapping should be performed using other methods, such as SCIM," and the "Enable JIT provisioning" checkbox is checked.
Fig: Select an SSO protocol

Because Descope mediates communication between Okta and your app, the two need a secure, trusted connection. This connection is established by exchanging metadata XML documents between both platforms. The good news: Descope’s built-in Okta integration makes this process much simpler.

  • Go to your Okta account and click Admin to access your admin dashboard:

Okta end-user dashboard. The left sidebar lists My Apps (selected), Work, Add section, Notifications with a badge of 1, and Add apps. The top bar has a "Search your apps" field, and a red arrow points to the "Admin" button beside the blurred account name. The main area is titled "My Apps" with a Sort dropdown, and a "Work" section holding one app tile, "Okta Workflows." An "Add section" button sits below.
Fig: Okta dashboard
  • Navigate to Applications > Applications and click Browse App Catalog to explore a comprehensive list of available integrations:

Okta admin console with three numbered callouts. The left navigation lists Dashboard, Directory, Customizations, Applications, and Security. Callout 1 marks the expanded "Applications" section, and callout 2 marks its "Applications" sub-item, which sits above Self Service and API Service Integrations. On the Applications page, callout 3 marks the "Browse App Catalog" button, which sits between "Create App Integration" and "Assign Users to App," followed by a More menu. A "Search for people, apps and groups" field is at the top. Below the buttons, a Search field and a Status filter show 1 active and 0 inactive apps, and the list includes Okta Admin Console and Okta Browser Plugin.
Fig: Okta admin dashboard
  • Search for Descope in the catalog and add the integration. This creates a new Okta app automatically.

Okta "Browse App Integration Catalog" page, under the breadcrumb Applications > Catalog > All Integrations, with a "Create New App" button. The search field contains "descope" and a results dropdown is open. Popular searches are Bookmark App, SCIM 2.0 Test App, Okta Org2Org, and Template App. A red arrow points to the first result, "Descope," labeled "OIDC, SCIM, SAML." Other results are Runscope (SAML), SCOPE (SAML), Runscope Provisioning Connector (name truncated), and Alfresco (SWA), with a "See All Results" link. The Use Case sidebar lists All Integrations 7887, Apps for Good 13, Automation 184, Centralized Logging 47, Directory and HR Sync 76, Bot or Fraud Detection 7, Identity Proofing 43, Identity Governance and Administration (IGA) 62, Lifecycle Management 696, and multi-factor authentication (MFA) 65.
Fig: Add Okta Descope integration
  •  In the General Settings tab, provide a label for your new Okta app.

Okta "Add Descope" setup page with two steps, "1 General Settings" (active) and "2 Sign-On Options." Under the heading "General settings · Required," the "Application label" field contains "Streamlit Auth & SSO with Descope," with the hint "This label displays under the app on your home page." The "Application Visibility" option has an unchecked box labeled "Do not display application icon to users." Cancel and Next buttons sit at the bottom of the form. A side note titled "General settings" reads "All fields are required to add this application unless marked optional."
Fig: Okta app general settings
  • Switch to the Assignments tab and assign users who should have access to your Streamlit app via SSO:

Okta application page for "Streamlit Auth & SSO with Descope," showing the Descope logo, an "Active" status dropdown, and links for View Logs and Monitor Imports. The tabs are General, Sign On, Provisioning, Import, Assignments, and Push Groups, and Assignments is selected. The toolbar has an "Assign" dropdown button, a "Convert assignments" dropdown, a Search field, and a "People" filter. Filters on the left are People (selected) and Groups. The assignments table has Person and Type columns with one row: Gideon Idoko, me@gideonidoko.com, type Individual, with edit and remove icons. Reports and Self Service panels are cut off at the right edge.
Fig: Assign users to the Okta app
  • Switch to the Sign-On Options tab and select SAML 2.0. Copy the Metadata URL then paste it into your tenant’s SSO configuration in Descope. Next, copy the ACS URL and Entity ID from Descope into the Advanced Sign-on Settings in Okta:

Okta Advanced Sign-on Settings form with the note "These fields may be required for a Descope proprietary sign-on option or general setting." The ACS URL field contains a value that starts with "https://api.descope.com/v1/auth/saml/acs?projectId=" and is cut off, with the help text "Please enter your ACS URL (required only for SAML Sign on method). Refer to the Setup Instructions to obtain this value." The Entity ID field contains a value that starts with "P2i9lk" and is otherwise blurred, with the help text "Please enter your Entity ID (required only for SAML Sign on method). Refer to the Setup Instructions to obtain this value." The Callback URL field is empty, with the help text "Please enter your Callback URL (required only for OIDC Sign on method). Refer to the Setup Instructions to obtain this value."
Fig: Okta Advanced Sign-on Settings
  • Expand the Attribute Statements section in Okta. Map the following values:

    • firstName > user.firstName

    • lastName > user.lastName

    • email > user.email

    • uid > user.id

These mappings define how user attributes are passed from Okta to Descope.

Okta sign-on options with SAML 2.0 selected. The Default Relay State field is empty, with the note "All IDP-initiated requests will include this RelayState." The expanded Attributes (Optional) section, which has a Learn More link, shows an Attribute Statements (optional) table with the columns Name, Name format (optional), and Value. Four rows are filled in, each with the name format Unspecified: firstName maps to user.firstName, lastName maps to user.lastName, email maps to user.email, and uid maps to user.id. An Add Another button follows. Below, the Group Attribute Statements (optional) table has the columns Name, Name format (optional), and Filter, with one empty row set to Unspecified and Starts with, followed by a second Add Another button.
Fig: Update Okta attribute mapping
  • Back in Descope, update your tenant’s SSO Mapping settings so attributes from Okta align correctly with Descope’s schema.

SSO Mapping section of the tenant SSO settings in the Descope Console. Under User Attribute Mapping, with the description "Map user attributes from your Identity Provider (IdP) to Descope," three rows pair an IdP user value with a Descope user attribute: name maps to Display Name, email maps to Email, and lastName maps to Family Name. An "Add user attribute mapping" link follows. Under Group Mapping, the description reads "Enter the name of the IdP attribute used for groups association. We will use it to retrieve the IdP group names." The Groups attribute name field is empty, followed by the text "Click the add button to map SSO Groups from your IdP to Descope." and an "Add group mapping" link.
Fig: Descope SSO mapping

Once this is complete, you’ve established a working SAML SSO configuration between Okta, Descope, and your Streamlit app.

It’s worth noting that Descope also provides a self-service SSO configuration designed for multi-tenant environments. With this setup, each tenant can maintain its own SSO configuration, and tenant admins can manage their Descope SSO settings directly through your application.

To enable this, you can either:

  • Embed the out-of-the-box sso-config flow into your app’s admin interface, or

  • Generate a configuration link that tenant admins can use directly.

For detailed implementation guidance, refer to the Descope documentation.

Implementing the SSO flow in Streamlit

Now that you’ve configured SAML SSO between Okta and Descope, the next step is to implement the flow inside your Streamlit app. This will let users authenticate through Okta and seamlessly return to your app. So let’s add another button under the Sign In with Google button that starts the SSO flow when clicked.

First, you’ll need your tenant ID from the Descope console:

  • Go to your tenant’s settings.

  • Copy the Tenant ID.

  • Add it to your .streamlit/secrets.toml file with the DESCOPE_TENANT_ID key

  • Update the st.container element in your code like this:

# … collapsed repeated code
TENANT_ID = str(st.secrets.get("DESCOPE_TENANT_ID")) # Get tenant ID from secret

# … 

    with st.container(border=True):
        # … google button here

        if st.button("Sign in with SSO", use_container_width=True):
            sso_response = descope_client.sso.start(
                tenant=TENANT_ID, return_url="http://localhost:8501"
            )
            url = sso_response["url"]
            # Redirect to Okta
            st.markdown(
                f'<meta http-equiv="refresh" content="0; url={url}">',
                unsafe_allow_html=True,
            )
# … 

Your Streamlit app should now look like this:

Streamlit app running at localhost:8501 in a browser, in its signed-out state. A yellow warning banner reads "You're not logged in, pls login." Below it, a bordered box holds two full-width buttons separated by the text "------- OR -------": "Sign In with Google" on top and "Sign in with SSO" beneath it. The Streamlit Deploy option and a menu icon appear at the top right.
Fig: Streamlit app final login look

Click Sign In with SSO to go to Okta for verification. Sign in with one of the users you assigned earlier. After successful authentication, you’re redirected back to your Streamlit app with a code query parameter—just like in the OAuth flow. Since you already implemented the code exchange, you’ll be signed in automatically:

Streamlit app in a browser tab titled "app · Streamlit" at localhost:8501, shown after a successful SSO login. The page heading reads "Demo App," followed by the line "This is a demo app with Descope-powered authentication and SSO." A subheading reads "Welcome! you're logged in," and below it the user details read "Name: Gideon" and "Email: me@gideonidoko.com," with the email address shown as a link. A Logout button sits beneath the details, and the Streamlit Deploy option and a menu icon appear at the top right.
Fig: Streamlit SSO authenticated view

Managing authorization and user privileges

While authentication verifies the user’s identity, authorization controls their access to resources and features based on predefined roles and permissions. The Descope console includes tools to manage user roles and permissions so you can enforce access control in your Streamlit app. After login, Descope returns role information you can use to tailor the UI and gate functionality.

All roles and permissions live under the Authorization page. A Tenant Admin role is created by default. Let’s assign that role to a user and then conditionally display admin-only content in the app.

Go to the Users page, click the kebab menu of the user you want to update, and click Edit:

Users page in the Descope Console for the project streamlit-auth-sso. The left navigation lists Home and Getting Started, then a Build group with Authentication Methods, Flows, Widgets, Styles, Localization, and Connectors, then a Manage group with Users (selected) and Access Keys. The main panel is titled Users, with the description "An overview of all of your users and their information. Edit their configuration, and manage custom attributes." and a Learn More link. It has Users and Custom Attributes tabs, a Search field, a Filter control, and "+ User" and "Import Users" buttons. The table has the columns Login ID, Status, Display Name, and Email, and lists three users, all with the status Active; their login IDs and details are mostly blurred. The kebab menu for the first user is open with the options Edit, Disable, Delete, and Force Logout, and a red arrow points to Edit.
Fig: Edit Descope user

In the modal, select Tenant Admin in the Roles field and click Save:

Authorization section of the edit user modal in the Descope Console. Under the text "Define user access to tenants, and assign roles:" a Tenants dropdown has no selection, and the Roles field next to it contains the selected value Tenant Admin, with plus and minus buttons to add or remove a row. Under the text "Define user access to applications:" the Applications field contains All Applications. Cancel and Save buttons sit at the bottom right.
Fig: Assign admin role to a user

Update your code to show an admin indicator:

# … collapsed repeated code
        if "user" in st.session_state:
            # …
            if "Tenant Admin" in user["roleNames"]:
                # Show admin-specific content
                st.success("ADMIN", icon="🤖")
# …

This should now be the view of the admin user when they’re signed in:

Streamlit app at localhost:8501 in a browser, shown as a signed-in admin user. The page heading reads "Demo App," followed by the line "This is a demo app with Descope-powered authentication and SSO." A subheading reads "Welcome! you're logged in," and the Name and Email values beneath it are blurred. A green banner with a robot emoji reads "ADMIN," and a Logout button sits below it. The Streamlit Deploy option and a menu icon appear at the top right.
Fig: Admin view

This approach ensures that only authorized users see privileged features, improving both the security and integrity of your app.

You can find the full code on GitHub.

Streamlit SSO and authentication with Descope

You just wired Streamlit SSO with Descope end to end: created a Descope project, added OAuth social login, implemented SAML SSO with Okta, and gated features with roles. You now have a secure pattern you can reuse across Streamlit apps, from personal dashboards to multi-tenant products.

Ready to keep going? Use your Free Forever account to extend your app with passwordless options, adaptive MFA, and SCIM provisioning. Have questions or edge cases to discuss? Book time with the team for a focused walkthrough.