Beta

Create a tenant

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

RP-initiated logout

When Ava wants the photo service signed out too, the collage app cannot end that session itself. It ends its own session, then sends her browser to the provider's end session endpoint with a hint about which session it means and a registered address to come back to.

Asking the provider to sign Ava out

After the trouble at the library in Local logout and provider sessions, the collage app changes its Sign out page. It now offers two buttons: Sign out, which ends only the collage app's session, and Sign out of the collage app and the photo service. On a shared computer, the second one is the button Ava wants. All domains, identifiers and tokens in these examples are fictional.

The collage app cannot end the photo service's session by itself. That session is a record on the photo service's servers, found through a cookie that belongs to auth.photos.example, which the collage app can neither read nor delete. It has to ask, and the request has to travel through Ava's browser, because that is where the photo service's cookie is. RP-Initiated Logout, where RP stands for the relying party that starts it, is the OpenID Connect specification for that request.

The collage app finds where to send the request in the photo service's discovery document, which includes this entry:

{
  "issuer": "https://auth.photos.example",
  "end_session_endpoint": "https://auth.photos.example/logout"
}

This is the provider's end session endpoint, sometimes called its logout endpoint. On the collage app's side, the registration lists the addresses where the photo service may send the browser afterward, in the post_logout_redirect_uris field that Registering a relying party introduced. The collage app registered one address, its ordinary signed-out page, https://collage.example/signed-out.

When Ava selects the second button, the collage app does three things in order. It reads the ID token it kept in her session record. It ends its own session, deleting the record and clearing the cookie, just as the ordinary Sign out does. Then it redirects her browser to the end session endpoint.

The specification leaves that order to the relying party. The collage app could keep its session until the photo service tells it the sign-out happened, but that would depend on things it cannot count on. Ava might decide at the photo service to stay signed in, or close the tab, and the notification might not arrive. Ending the local session first means the one sign-out the collage app controls has already happened, whatever follows.

The logout request

The collage app's redirect sends Ava's browser to this address, shown with its parameters on separate lines so we can read them:

https://auth.photos.example/logout
  ?id_token_hint=eyJhbGciOiJSUzI1NiIsImtpZCI6InBob3Rvcy1ycy0yMDI2LTA5IiwidHlwIjoiSldUIn0.eyJpc3MiOiJodHRwczovL2F1dGgucGhvdG9zLmV4YW1wbGUiLCJzdWIiOiJ1c2VyLTIwNDgi...
  &post_logout_redirect_uri=https%3A%2F%2Fcollage.example%2Fsigned-out
  &state=demo-signout-1

The ID token is shortened for display. The specification defines six parameters for this request, and the collage app uses three of them:

ParameterWhat it does
id_token_hintAn ID token the provider issued to this client, telling it which client, person, and session the request is about. Recommended. The collage app sends the ID token from Ava's 09:00 sign-in.
post_logout_redirect_uriWhere to send the browser afterward. It must exactly match a registered address.
stateA value returned unchanged with the browser, so the collage app can recognize its own request. Here demo-signout-1.
client_idNames the client. Mostly used when there is no ID token hint. If both are sent, the provider checks that they agree.
logout_hintA hint about who is signing out, in a form the provider defines, such as an email address or a username.
ui_localesPreferred languages for any page the provider shows, such as en-US.

The ID token in the hint expired at 09:05, and it is now 09:40. That does not matter, because the hint is not being used as proof of anything. The photo service checks that it issued the token, by verifying its own signature, and the specification asks it to accept an expired token when the client it names has a current or recent session. From aud, sub and sid it learns that the collage app is asking about Ava's session, demo-session-51. If that sid did not match the session in this browser, because someone else had signed in since, the photo service would treat the request as suspect and could refuse to act on it.

A hint in a URL is recorded wherever URLs are recorded, such as browser history and server logs. The base ID token here carries only identifiers and times, but a provider that copies profile claims into its ID tokens would put those into the address as well. Providers must accept the logout request as a form POST as well as a GET, so a relying party that wants the hint out of the address bar can send it from a form that submits itself.

At the end session endpoint, the photo service shows a page asking whether Ava wants to sign out of the photo service. The specification says a provider should normally ask, and must ask when the request has no valid ID token hint or names a session other than the one in this browser. Without that rule, any website could sign people out of the photo service with a link, which the specification treats as a form of denial of service: an attack that stops people using a service rather than stealing from it.

Ava confirms, and the photo service ends its session. It then notifies the other relying parties signed in through that session, using whichever notification each one registered. That includes the collage app, which registered for back-channel notices. Front-channel logout and Back-channel logout describe those notifications. Only then does it redirect the browser back. A request to sign out when the photo service has no session for that browser is not an error, so a second click, or a request after its session had already expired, simply succeeds.

Coming back

The photo service sends Ava's browser to the address the collage app named, adding the state value:

https://collage.example/signed-out?state=demo-signout-1

It does so only because the address exactly matches one in the collage app's registration. Any other value, even one differing by a trailing slash, is an error: the provider performs no redirect and shows its own page, where it may still offer to sign Ava out. Without that rule, a logout link could send people from the photo service to any page an attacker chose, perhaps one asking them to sign in again. For the same reason, a request with a post-logout address but no ID token hint gets no redirect unless the provider has some other way to confirm that the address is legitimate. Sending client_id in that case at least tells the provider which registration to check the address against.

Registered post-logout address

https://collage.example/signed-out

Address and hint

post_logout_redirect_uri
/signed-out
id_token_hint
Sent
Provider answers
Redirect with state

Ava returns to the collage app

One character added

post_logout_redirect_uri
/signed-out/
id_token_hint
Sent
Provider answers
Its own page

No redirect

Address without a hint

post_logout_redirect_uri
/signed-out
id_token_hint
Missing
Provider answers
Its own page

No redirect unless confirmed

The return shows that the browser came back, not that the photo service ended its session.

Three logout requests from the collage app. Only the exact registered address, with an ID token hint, brings Ava back; the others end on the photo service's own page.

Ava's session at the collage app no longer exists, so the collage app kept demo-signout-1 in a short-lived cookie of its own when it sent her away. When she returns, it compares the value. If it matches, the collage app deletes the cookie and shows a page that says she is signed out of the collage app, and that signing out of the photo service was a choice the photo service asked her about. If the value is missing or different, the collage app shows an ordinary signed-out page. Because the collage app ended its session before the redirect, a forged return has nothing to restore or change.

Notice what the page does not say. The return shows that Ava's browser came back, not that the photo service ended its session. She might have chosen to stay signed in there, and providers differ in whether they still send the browser back after a person declines. If the collage app ever needs to know that the photo service's session ended, that knowledge comes from a logout notification, not from this redirect.

The collage app ends its own session before it asks the photo service to end the provider session. The return to the collage app shows that the browser came back, not that the provider signed Ava out.

Any other application Ava signed in to with her photo account at the library is signed out only if it registered for one of the photo service's logout notifications, and only if that notification reaches it. If the photo service did not offer an end session endpoint at all, the most the collage app could do is say that she is still signed in there and link to the photo service's own sign-out page.

Check your understanding

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

The collage app's logout request asks to return to https://collage.example/signed-out/ with a trailing slash, but the registered address has none. What should the photo service do? 1 of 3

Choose one answer.

The ID token the collage app sends as id_token_hint expired 35 minutes ago. What happens? 2 of 3

Choose one answer.

A page on another site links Ava's browser to the photo service's end session endpoint with only the collage app's client_id. What should the photo service do? 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