Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

Local logout and provider sessions

An application's Sign out button ends the session that application created, and nothing else. The identity provider's session stays in the browser, ready to sign the next person in, so deciding what logout should end is a design choice, and it starts with naming the provider's session.

What signing out ends

In Requesting stronger authentication, the collage app sent Ava back to the photo service for a passkey before she could download a board's full-resolution originals. The OpenID Connect lessons so far have all been about getting in: proving who you are, carrying that proof to an application, and deciding whether it is strong or recent enough. Getting out raises problems of its own. All domains, identifiers and tokens in these examples are fictional.

Ava uses the collage app at collage.example, a relying party registered with the photo service as photo-collage. At 09:00 on 7 October she is at a computer in the public library. She chooses Continue with your photo account, signs in at the photo service, and the collage app validates the ID token it receives and starts its own session for her, as Establishing an application session described. At 09:40 she selects Sign out. The collage app shows its signed-out page, and she leaves.

The collage app's Sign out button ends the session the collage app created. As Staying signed in described, that takes two steps: deleting the session record on the collage app's server, and removing the cookie that pointed to it. The response replaces the cookie with an empty one that has already expired:

HTTP/1.1 303 See Other
Location: https://collage.example/signed-out
Set-Cookie: __Host-collage-session=; Path=/; Max-Age=0; Secure; HttpOnly; SameSite=Lax

The empty cookie repeats the original attributes because a browser accepts a __Host- cookie, even one that deletes another, only with Secure, Path=/ and no Domain. Max-Age=0 tells the browser the cookie has already expired, so it removes it. Deleting the server record is the step that matters most. If a copy of the old cookie value survived somewhere, in the shared computer's memory or in a log, it would now find nothing.

Anything the collage app kept for the session goes with it: Ava's account, the issuer, her subject, when she authenticated, and a copy of the ID token for signing out later.

One thing should survive. Ava also turned on the collage app's year-end collage, so the app holds a refresh token that lets it collect her best photos every December. That connection is an authorization Ava granted, not a sign-in, and Offline access and refresh behavior explained why the two are kept apart. Signing out of a website should not quietly cancel next December's collage. Disconnecting the year-end collage is a separate choice the collage app offers on its own.

Ending the application's own session like this is called local logout. The collage app can do it completely and reliably, because it controls everything involved. It is also all the collage app has done.

The session Ava left behind

At 09:50 the next person at the library computer opens the collage app and selects Continue with your photo account. The collage app sends the browser to the photo service, exactly as it did for Ava. The photo service finds its own session cookie in the browser, set when Ava signed in at 08:59:45, and its policy accepts a session that recent without asking again. It issues a fresh ID token for Ava's subject, user-2048, and sends the browser back.

The collage app validates that token, and every check passes. The signature is genuine, the issuer and audience are right, and the nonce matches the new attempt. The collage app signs a stranger in to Ava's account. Nothing was forged. The collage app ended the session it controlled and left the photo service's session running in the same browser.

The collage app's session

Found through
__Host-collage-session
After Sign out
Ended
At 09:50
Nothing to find

Local logout

The photo service's session

Found through
The photo service's cookie
After Sign out
Still active
At 09:50
Fresh ID token for user-2048

A stranger signed in to Ava's account

The year-end collage connection

Found through
A refresh token
After Sign out
Still active
At 09:50
Unchanged

Ends only when Ava disconnects

Nothing was forged. The collage app ended the session it controlled.

What Ava's Sign out at the collage app ended, and what it left running in the library's browser. The photo service's session is the one that signs the next person in.

Single sign-on made Ava's morning easy, and the same convenience is at work here. Trust across systems pointed out that signing out of one application does not end the identity provider's session, or the sessions of other applications that relied on it. By the time Ava leaves the library, the browser can hold several sessions, each with its own owner:

SessionWhere it livesWhat ends it
The collage app's sessionA record on the collage app's server, found through the __Host-collage-session cookie for collage.exampleThe collage app's Sign out, or its idle or absolute timeout
The photo service's sessionThe photo service's own records, found through its cookie for auth.photos.exampleSigning out at the photo service, or the photo service's own timeouts
Other applications' sessionsEach application Ava signed in to with her photo account during the visitEach application separately

The ID token is not on that list. Its exp passed at 09:05 without changing anything, because an ID token describes one sign-in and is not a session. Application accounts and sessions described these as independent lifetimes; the library is where that independence starts to hurt.

To coordinate across those sessions, the collage app and the photo service need a way to name the photo service's session, not just Ava's account. Providers that send logout notifications give each of their sessions an identifier and place it in ID tokens as the sid (session ID) claim. The photo service does this for clients registered for its notifications, so the collage app registers an address for the server-to-server logout notice that Back-channel logout describes. From then on an ID token like the one from Ava's 09:00 sign-in carries one more claim:

{
  "iss": "https://auth.photos.example",
  "sub": "user-2048",
  "aud": "photo-collage",
  "iat": 1791363600,
  "exp": 1791363900,
  "auth_time": 1791363585,
  "nonce": "demo-nonce-9",
  "sid": "demo-session-51"
}

The value is opaque. The collage app does not try to parse it, and it means something only together with the issuer, since another provider could use the same string. Every application Ava signed in to through the same photo service session receives the same sid. The collage app stores it in the session record beside iss and sub. Later, a message about session demo-session-51 at https://auth.photos.example can be matched to Ava's session at the collage app, and a sign-out request from the collage app can tell the photo service which of its sessions it means. sid is a name, not a credential: holding it proves nothing, and it says nothing about whether the session is still active.

Choosing what logout means

The library shows what goes wrong when a sign-out ends less than Ava expects. The opposite happens too. At home, she might sign out of the collage app while she is still sorting photos at the photo service in another tab. If the collage app's Sign out also ended the photo service's session, she would be signed out there without warning, along with every other application that depended on it.

Consumer services usually keep local logout as the meaning of Sign out and offer the wider choice openly. The collage app can tell Ava that she is still signed in to the photo service and offer to sign her out there too, which matters most on a shared computer. The photo service, for its part, normally asks before ending its own session, because it knows better than the collage app what else she is using.

Organizations tend to want more. When a designer at Lantern Studio signs out of the portal at the end of the day, Lantern expects the session at its identity provider to end and the timesheets application to sign out as well, so the next person at the workstation finds nothing open. When a designer leaves Lantern, an administrator expects every one of their sessions to end at once, without waiting for the designer to click anything. Ending the sessions at several applications from one event is often called single logout.

OpenID Connect provides four mechanisms for these goals, each defined in its own specification. A relying party, or RP, is the application that relies on the provider's sign-in, such as the collage app:

MechanismWho starts itHow the message travels
RP-initiated logoutThe relying party, when the person asksThe browser is redirected to the provider's end session endpoint, which can end the provider's session
Front-channel logoutThe provider, after its session endsThe browser loads each application's logout page in a hidden frame
Back-channel logoutThe provider, after its session endsThe provider's server sends each application's server a signed logout token
Session managementThe relying party, repeatedlyA script in the application's page asks a frame from the provider whether its session has changed

The first answers the library problem: the collage app asking the photo service to end its session too. The other three carry the news from the provider to applications that did not start the sign-out. Which ones a deployment uses depends on its applications and on what its provider supports. None of them can guarantee that every message arrives, so each application keeps its own idle and absolute timeouts as a limit on how long a missed sign-out can matter.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Ava signs out of the collage app on a library computer. Minutes later, the next person chooses Continue with your photo account and is signed in to her collage account without entering a password. What happened? 1 of 3

Choose one answer.

Why does the collage app store the sid claim from Ava's ID token in its session record? 2 of 3

Choose one answer.

Ava wants Sign out at the collage app to be safe on a shared computer without cancelling her year-end collage. Which design fits? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity