Synq
Skip to content
[ synq / docs ]Synq home

Authentication routes

Device sessions, refresh rotation, session list and logout.

Sign-in itself starts with the /v2/auth/challenge login challenge (audience native for the iOS app). The wallet signs the challenge and the client exchanges it here for a device session. Login proves wallet ownership and never approves money.

Each device holds one live session: signing in again from the same deviceId revokes the previous one. The access token is valid for 15 minutes. The refresh token is valid for 30 days and rotates on every use; presenting a refresh token that was already rotated away revokes the whole device session and answers SESSION_REVOKED, because someone else may hold a copy.

The unauthenticated routes in this group are throttled per client address (20 requests a minute).

Routes#

POST /v3/auth/device-session#

Exchange a signed native login challenge for a device session.

Route idauth.deviceSession
AuthNone
Who may callwallet that signed the /v2 login challenge
StatusIMPLEMENTED

Request body (DeviceSessionRequest)

FieldTypeRequiredNotes
challengeIduuidyes
signaturestring (^0x[0-9a-fA-F]{130}$)yes
deviceDeviceyes

Response (DeviceSession)

FieldTypeRequiredNotes
principalIdstring (max 80)yes
sessionIduuidyes
accessTokenstring (^[0-9a-f]{64}$)yes
accessExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp
refreshTokenstring (^[0-9a-f]{64}$)yes
refreshExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp

POST /v3/auth/device-session/code#

Exchange a one-time web sign-in code for a device session (no wallet on the phone).

Route idauth.deviceSessionFromCode
AuthNone
Who may callholder of a fresh one-time code from a signed-in web session
StatusIMPLEMENTED

Request body (DeviceCodeSessionRequest)

FieldTypeRequiredNotes
codestring (^[0-9a-f]{48}$)yes
deviceDeviceyes

Response (DeviceSession)

FieldTypeRequiredNotes
principalIdstring (max 80)yes
sessionIduuidyes
accessTokenstring (^[0-9a-f]{64}$)yes
accessExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp
refreshTokenstring (^[0-9a-f]{64}$)yes
refreshExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp

POST /v3/auth/refresh#

Rotate tokens. Reusing an old refresh token revokes the session.

Route idauth.refresh
AuthNone
Who may callholder of the current refresh token for that device
StatusIMPLEMENTED

Request body (RefreshRequest)

FieldTypeRequiredNotes
deviceIduuidyes
refreshTokenstring (^[0-9a-f]{64}$)yes

Response (DeviceSession)

FieldTypeRequiredNotes
principalIdstring (max 80)yes
sessionIduuidyes
accessTokenstring (^[0-9a-f]{64}$)yes
accessExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp
refreshTokenstring (^[0-9a-f]{64}$)yes
refreshExpiresAtISO-8601 timeyesUTC ISO-8601 timestamp

GET /v3/auth/sessions#

The principal's signed-in devices.

Route idauth.sessions
AuthSession (bearer or cookie)
Who may callprincipal
StatusIMPLEMENTED

Response (SessionList)

FieldTypeRequiredNotes
sessionsSessionSummary[]yes

POST /v3/auth/logout#

End this device session.

Route idauth.logout
AuthSession + Idempotency-Key (+ same origin for cookies)
Who may callprincipal
StatusIMPLEMENTED

Response (Ok)

FieldTypeRequiredNotes
oktrueyes

POST /v3/auth/revoke-all#

End every session of this principal, including this one.

Route idauth.revokeAll
AuthSession + Idempotency-Key (+ same origin for cookies)
Who may callprincipal
StatusIMPLEMENTED

Response (RevokeAll)

FieldTypeRequiredNotes
revokedinteger (min 0)yes

Edit this page on GitHub