Documentation

Logout

Sign people out, and hear when a session ends: RP-initiated, back-channel and front-channel logout.

All documentation

Sign the person out

Send the browser to /end-session, by GET or by a form POST (Auth turns a POST into a GET of the same request first, so its cookies arrive). Auth ends its own session in that browser and every application session that browser sign-in started in your workspace, then returns to post_logout_redirect_uri when it is registered for the application.

Sign-out URL
https://auth.ziqme.com/end-session?client_id=app_your_client_id
  &post_logout_redirect_uri=https://app.example/
  &state=YOUR_STATE
  &id_token_hint=THE_ID_TOKEN
  • id_token_hint is the ID token the person signed in with. It may have expired. Auth then ends that session even when the browser no longer has its own Auth cookie, and it identifies your application when client_id is left out.
  • A hint issued to another application than client_id is ignored.
  • The SDKs send the hint for you: createBrowserAuth().signOut() and the Vue and React components.

Back-channel logout

Register a back-channel logout URI on the application (Security, Logout). Whenever one of its sessions ends, Auth posts a signed logout token to it from its own servers: when the person signs out, signs out everywhere, or an administrator ends their sessions. It reaches you even when the browser is closed.

What Auth sends
POST https://app.example/logout/backchannel
Content-Type: application/x-www-form-urlencoded

logout_token=eyJhbGciOiJSUzI1NiIsInR5cCI6ImxvZ291dCtqd3QiLC...
ClaimValue
typ (header)logout+jwt
issThe issuer your ID tokens name, a workspace issuer included
audYour client ID
subThe person
sidThe session that ended: the sid of the ID token you received for it
events{"http://schemas.openid.net/event/backchannel-logout": {}}
iat, exp, jtiIssued now, valid for 2 minutes, unique per token
Verify it (Node)
import { verifyLogoutToken } from '@smartdesk/auth-sdk'

app.post('/logout/backchannel', express.urlencoded({ extended: false }), async (req, res) => {
  try {
    const { sid } = await verifyLogoutToken(req.body.logout_token, { issuer: 'https://auth.ziqme.com', audience: 'app_your_client_id' })
    await sessions.endBySid(sid)
    res.sendStatus(200)
  } catch {
    res.sendStatus(400)
  }
})
  • The URI must be HTTPS and reachable from the internet. Auth does not follow redirects.
  • Answer 2xx once the session is ended. A timeout, 429 or 5xx is retried twice, after 5 and 30 seconds; any other 4xx is not retried.
  • Every delivery and every final failure is written to the audit log (session.backchannel_logout_delivered, session.backchannel_logout_failed).
  • With any other library: verify it like an ID token against the JWKS, with typ logout+jwt, then check the events claim and that there is no nonce.

Front-channel logout

Register a front-channel logout URI to clear your own cookies in the person's browser. When they sign out at /end-session, the page that confirms it loads your URI in a hidden frame, with iss and sid added unless you switch that off, and moves on to post_logout_redirect_uri three seconds later. Use HTTPS (HTTP is accepted on localhost). Browsers that block third-party cookies may not send your cookies to the frame, so prefer the back channel where you can.

Discovery

The discovery document advertises backchannel_logout_supported, backchannel_logout_session_supported, frontchannel_logout_supported and frontchannel_logout_session_supported, and lists sid in claims_supported.