Unified WorkOS callback — WorkOS is the source of truth.
Expected payload: { "code": "<authorization_code>" }
Three cases:
- User exists in both WorkOS and Django → login.
- User exists in WorkOS but not Django → provision immediately.
- User does not exist in WorkOS → code exchange fails, error returned.
Responses
access_tokenstring · requiredrefresh_tokenstring · requireduserobject · required
Log the current user out.
Two things make logout effective in this architecture:
- The webapp proxy clears the
tofu-webcookie via its outbound policy, so the browser can no longer present the access token. - The frontend redirects through
workos_logout_url(when present) to terminate the WorkOS-side session — otherwise AuthKit would silently re-authenticate on the next /signin.
We deliberately do NOT iterate OutstandingToken and call .blacklist()
on each one. The proxy strips refresh tokens from auth responses before
they ever reach the client (see set-auth-cookie-outbound), so those rows
are orphans — no device holds them, no one can present them to
/api/token/refresh/. Blacklisting defends against a threat that doesn't
exist here. If we ever start delivering refresh tokens to clients, revisit.
Response: { "message": "Successfully logged out", "workos_logout_url": "https://api.workos.com/.../logout?..." | null, "redirect_to": "/signin" }
Responses
messagestring · requiredredirect_tostring · required
workos_logout_urlstring | null

