Logout & Session Propagation
Local app logout, confirmed UniAuth browser logout, back-channel notification, and the Limited Beta front-channel browser attempt are separate. The browser attempt is not delivery or completion proof.
Common mistake: clearing your app’s session does not end the UniAuth browser session. Use end_session_endpoint to request confirmation. Cancelling leaves UniAuth signed in without restoring the app’s local session.
1. RP-Initiated Logout
When the user clicks “sign out” in your app, redirect them to end_session_endpoint. UniAuth asks for confirmation before ending the current browser session and returning to a registered post-logout URL. Cancelling does not undo any local logout your app already performed, but leaves the UniAuth session active.
// Build the logout URL from discovery
const params = new URLSearchParams({
id_token_hint: userIdToken, // RP/account context, not logout authority
post_logout_redirect_uri: 'https://yourapp.com/',
state: 'xyz123', // RP return correlation, not OP confirmation
})
window.location.href =
`https://uniauth.id/api/oauth/end-session?${params}`With our SDK, this is a single call:
const auth = new UniAuth({
issuer: 'https://uniauth.id',
clientId: 'your-client-id',
redirectUri: 'https://yourapp.com/callback',
postLogoutRedirectUri: 'https://yourapp.com/', // register this exact URL
})
await auth.logout()
// Local cleanup → best-effort refresh revocation → UniAuth confirmation.
// Cancelling there leaves the UniAuth session active, not this app's session.2. Back-Channel Logout
Confirmed authenticated logout atomically commits exact, per-event-bounded delivery intent with the retired session only when conservative global and server-derived ownership-scope delivery ceilings admit it. A separate worker uses durable per-scope round-robin preparation and dispatch, revalidates the exact RS256 client, grant, contact and unchanged eligible HTTPS backchannel_logout_uri, then sends the same sealed Logout Token at most three times within 15 minutes. Preparing, prepared, dispatching, or retry-wait work is capped at eight globally and four per scope. Authority changes after the pre-send gate cannot recall an in-flight request; later attempts cancel. Receiving apps must validate the token and end matching sessions. Remote delivery is not guaranteed, and the unmeasured source defaults are not deployed capacity or an SLO.
The Developer Console does not currently expose this metadata. Request operator-managed Limited Beta enrollment for an eligible back-channel URL.
Verifying the Logout Token
UniAuth sends a logout token as application/x-www-form-urlencoded with logout_token=.... It’s an RS256-signed JWT. The decoded payload looks like this (per OIDC Back-Channel Logout 1.0 §2.4):
{
"iss": "https://uniauth.id",
"aud": "uni_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"iat": 1740000000,
"exp": 1740000120,
"jti": "b6c2e7...",
"sub": "2b7f163...", // pairwise sub (same one your ID token carried)
"sid": "0123456789abcdef0123456789abcdef", // present if you registered backchannel_logout_session_required=true
"events": {
"http://schemas.openid.net/event/backchannel-logout": {}
}
// MUST NOT contain a 'nonce' — if one is present, reject the token.
}Your verification code:
// Node.js example using jose
import { jwtVerify, createRemoteJWKSet } from 'jose'
const JWKS = createRemoteJWKSet(
new URL('https://uniauth.id/.well-known/jwks.json')
)
app.post('/logout-webhook', express.urlencoded(), async (req, res) => {
const token = req.body.logout_token
try {
const { payload, protectedHeader } = await jwtVerify(token, JWKS, {
issuer: 'https://uniauth.id',
audience: process.env.CLIENT_ID,
algorithms: ['RS256'],
})
// UniAuth token-class and required claim checks
if (protectedHeader.typ !== 'logout+jwt') {
return res.status(400).end()
}
if (!Number.isSafeInteger(payload.iat) || !Number.isSafeInteger(payload.exp)) {
return res.status(400).end()
}
if (typeof payload.jti !== 'string' || payload.jti.trim().length === 0) {
return res.status(400).end()
}
const sub = typeof payload.sub === 'string' && payload.sub.trim().length > 0
? payload.sub : undefined
const sid = typeof payload.sid === 'string' && payload.sid.trim().length > 0
? payload.sid : undefined
if (!sub && !sid) {
return res.status(400).end()
}
const logoutEvent = payload.events?.['http://schemas.openid.net/event/backchannel-logout']
if (logoutEvent == null || typeof logoutEvent !== 'object' || Array.isArray(logoutEvent)) {
return res.status(400).end()
}
if (Object.prototype.hasOwnProperty.call(payload, 'nonce')) {
// Logout tokens MUST NOT contain a nonce
return res.status(400).end()
}
// Invalidate all your local sessions for this user / sid
await invalidateSession({ sub, sid })
res.status(200).end()
} catch (err) {
res.status(400).end()
}
})3. Front-Channel Logout Browser Attempt (Limited Beta)
For up to 100 operator-enrolled recipients from one exact retired OP/RP session, an acknowledged optional post-commit transaction can publish a same-origin opaque handoff to request frontchannel_logout_uri with ?iss=...&sid=.... It is one-use and expires after five minutes.
The page makes hidden iframe requests and continues after every frame has an observed load/error or after eight seconds. Those observations do not prove RP receipt, processing, or session deletion; apps may remain signed in. Discovery and ordinary dynamic registration remain closed, with no named-RP interoperability, conformance, deployment, monitoring, capacity, availability, SLA, or every-app claim.
Which Should You Use?
| Mechanism | When It Fires | Requires Browser? | Recommended? |
|---|---|---|---|
| end_session | User confirms at UniAuth | Yes (navigation and confirmation) | ✅ To request UniAuth logout |
| back-channel | Best-effort after local logout commit | No (server-to-server) | ✅ If you have a backend |
| front-channel | After acknowledged optional commit; one-use for five minutes | Yes; browser attempt, observed load/error or eight-second bound | ⚠ Limited Beta browser attempt; not delivery proof |