TF Fiscal

SSO

POST/api/sso/consume_ticket

Consume SSO ticket

Exchanges the ticket generated by /api/sso/create_ticket for the TFiscal session JWT. This endpoint is called by the frontend (route /sso) and does not require sign/timestamp headers — the opaque ticket itself is the credential. Each ticket can be consumed only once and expires in 60 seconds.

Body

ticket*stringstringTicket returned by create_ticket

 * Required field.

Response fields

access_tokenstringstringSession JWT (365-day validity).
typestringstringUser type (user, admin, etc.)
uidintintInternal user ID
company_idintintID of the company selected in create_ticket
languagestringstringLanguage chosen in create_ticket (always normalized)
pagestringstringTarget page (or empty string if not set)

Error responses

MessageCause
Ticket inválidoBody without ticket field
Ticket inválido ou expiradoTicket does not exist, has already been consumed, or is past the 60-second limit
Rate limit exceededMore than 60 consumes per minute from the same IP
Sessão inválidaThe user linked to the ticket no longer exists

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/sso/consume_ticket" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json