On this page
Sign users out
Note: This document is written for Okta Classic Engine. If you’re using Okta Identity Engine, see User sign out (local app) for relevant guidance. See Identify your Okta solution (opens new window) to determine your Okta version.
This guide explains an important part of security: minimizing the chances that a malicious actor uses an existing session to perform unauthorized actions. It explains the most common strategies to prevent unauthorized use of a session, which include setting short token lifetimes and allowing users to sign out when they’re done. This guide explains how to sign users out of Okta and your app.
Learning outcomes
- How to define a sign-out callback.
- Sign users out of Okta and your app.
What you need
- Okta Developer Edition organization (opens new window)
- An app that can sign in to Okta. To create your own, see the following guides:
Sample code
About signing users out of an app
Signing users out of an app that is secured using Okta requires that you close the user's session in Okta. In cases where your app also has a session, you also need to close the user's app session.
Okta Session: Okta maintains a session for the user and stores their information inside an Okta-specific cookie. The next time that a user is redirected to the Okta sign-in page, the user's information is remembered. Sign users out of Okta by clearing the Okta browser session.
Application Session: Most apps have their own user sessions that you need to close in addition to an Okta user session.
Define the sign-out callback
Signing out of Okta requires the app to open a browser and go to the end session endpoint (opens new window). Okta ends the user's session and immediately redirects the user back to your app. To do this, define a callback route for the sign-out process that matches the post sign-out URL in your Okta app integration settings. If you don't specify a post_logout_redirect_uri
, then the browser is redirected to the Okta sign-in page.
Open the Admin Console for your org.
Go to Applications > Applications to view the current app integrations.
Select your app integration.
On the General tab, click Edit in the General Settings section.
Set a Sign-out redirect URIs section and add a handler for that URI.
Click Save to confirm your changes.
Sign users out of Okta
Sign users out of Okta by ending their session on the Okta authorization server.
Sign users out of your app
Sign users out of your app by ending their local session. This signs the user out of your app, but doesn't sign the user out of Okta.
The steps required to end the app session vary depending on the type of app that you’re using.
See also
Consider configuring self-service registration for your org.
Read more on customizing your org: