Ruby SDK

Sessions

Read the signed-in user, refresh and end a session with the user's tokens, and list or revoke any user's sessions with the secret key.

scute.sessions has two kinds of calls. Three take the user's own tokens and work without the secret key. Two take the secret key alone and need no user session.

With the user's tokens#

scute.sessions.current_user(access_token)   # the signed-in user; fails for a revoked sessionscute.sessions.refresh(refresh_token)       # new access (and refresh) tokensscute.sessions.sign_out(access_token)       # ends this session; the user's other sessions stay
MethodRequestHeader
current_user(access_token)GET /v1/auth/:app_id/current_userX-Authorization
refresh(refresh_token)POST /v1/auth/:app_id/tokens/refreshX-Refresh-Token
sign_out(access_token)DELETE /v1/auth/:app_id/current_userX-Authorization

current_user asks Scute, so a revoked session fails with Scute::APIError. In a session someone started as the user, the answer also has impersonation (who and why).

With the secret key#

scute.sessions.list(user_id)                  # the user's sessions, an Arrayscute.sessions.revoke(user_id, session_id)    # ends one session at once
MethodRequest
list(user_id)GET /v1/:app_id/users/:user_id/sessions
revoke(user_id, session_id)DELETE /v1/:app_id/users/:user_id/sessions/:session_id

A token from a revoked session still passes local verification until it expires. Verify with remote: true where that matters (see Verify tokens).