Complete an authentication attempt and create a handoff token
Completes an authentication attempt and mints a handoff_token.
A handoff token is the short-lived credential that a completed attempt hands
to the session exchange. Call this after every required factor is verified and
the attempt is in completed state. Otherwise it answers 409 with
att.not_completed: verify the remaining factors, then call again.
Exchange the token at POST /sessions/exchange (exchangeHandoff (POST /sessions/exchange)) within 60
seconds to receive the session and its session_token. The handoff token is:
- Single-use: exchange it once, with no retry.
- Bound to the project: the exchange needs the same project's credential.
- Created once: a second call answers
409 att.already_handed_off, even with the same idempotency key.
A revoked release is refused when the handoff is exchanged, not here. A
release is the configuration that zitadel deploy publishes.
oauth2 auth_attempt.writeAuthorizationBearer <token>Scope: auth_attempt.write
attempt_id*stringThe attempt_id that createAuthAttempt (POST /auth_attempts) returns.
^att_[a-zA-Z0-9_-]+$Idempotency-Key?stringOptional retry key. The server accepts it but does not use it: a
retry after a successful handoff answers 409 att.already_handed_off.
Retries carrying the same key within the exchange window return the same handoff token
without re-completing the attempt or minting a new token.
The handoff token and its expiry.
application/json- response
The handoff token and its expiry.
The handoff token is a short-lived credential, valid for 60 seconds at most.
The client exchanges it at POST /sessions/exchange to receive the final
session and session_token. It is single-use and bound to the project.
handoff_token*stringThe short-lived handoff token for session exchange.
Exchange at: POST /sessions/exchange
Requirements:
- Single-use
- Valid for 60 seconds at most
- Bound to the project: the exchange needs
sk_proj_…of the matching project
expires_at*stringWhen this handoff token expires.
date-timeimport { createZitadelApi, ZitadelClient } from "@zitadel/api/client";const api = createZitadelApi( new ZitadelClient({ baseUrl: process.env.ZITADEL_URL ?? "http://localhost:8080", token: process.env.ZITADEL_PROJECT_SECRET!, // server-side only }),);const authAttemptHandoff = await api.createAuthAttemptHandoff("att_01J0Z9KX7Y0Q2Y7JX5M9K2YF3C");{ "handoff_token": "string", "expires_at": "2019-08-24T14:15:22Z"}Was this helpful?