Logout oauth — GET /v1/iam/oauth/logout
Ends a sign-in and sends the browser somewhere sensible.
GET /v1/iam/oauth/logout
| Address | https://api.hanzo.ai/v1/iam/oauth/logout |
| Method | GET |
| Operation | get_iam_oauth_logout |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Ends a sign-in and sends the browser somewhere sensible. Accepts GET or POST, so it works as a plain link.
It ACTUALLY signs you out — worth stating, because a logout that computes a redirect and answers {"status":"ok"} while ending no session and revoking no token is worse than none: the person on the shared machine believes it worked. Three things happen here, in this order:
- The browser session dies — sid revoked server-side AND the cookie expired (sessions.Clear). Server-side revocation is the load-bearing half: a copy of the cookie taken before logout must not still resolve.
- The relying party's tokens are revoked when an id_token_hint names it, so
the refresh token cannot mint a fresh access token after the human left.
Revocation state is authoritative — a JWT's
expstill reads valid for days, so expiry is necessary but never sufficient. - Only then is a redirect considered, and only to a REGISTERED uri.
The open-redirect guard: a redirect happens only when a VERIFIED id_token_hint (or client_id) identifies the application and that application has registered the target. Nobody can turn your logout link into a redirect to a site of their choosing.
A GET is the end-session navigation (OIDC RP-Initiated Logout 1.0 §2), so it always ends on a page: the registered address when one was asked for, else this issuer's sign-in page for the application being signed out of. A relying party therefore needs no configuration to sign someone out. A POST is also how a program signs out, so it keeps the JSON answer unless it asks for HTML.
Request
GET /v1/iam/oauth/logout takes no parameters and no body — the credential is the whole request.
Response
The document declares no response body for this operation. It answers 200 on success and the platform error shape on failure — see Errors.
Examples
hanzo iam oauth logout getimport { Configuration, IamApi } from 'hanzoai';
const api = new IamApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getIamOauthLogout();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import IamApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = IamApi(client).get_iam_oauth_logout()cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.IamAPI.GetIamOauthLogout(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, iam_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = iam_api::get_iam_oauth_logout(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.IamApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new IamApi(client).getIamOauthLogout();curl https://api.hanzo.ai/v1/iam/oauth/logout \
-H "Authorization: Bearer $HANZO_API_KEY"MCP reaches iam through the iam tool, which names its 44 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_iam_applications"
}
}
}'