Auth0Client.Management.Session (auth0_client v1.0.0)

Copy Markdown View Source

A module representing session resource.

Addresses one session at a time. To find the ids, list a user's sessions with Auth0Client.Management.User.sessions/2; to end all of them at once, use Auth0Client.Management.User.delete_sessions/1.

Summary

Functions

Deletes a session

Gets a session

Revokes a session and every refresh token issued under it

Updates a session's metadata

Functions

delete(id)

Deletes a session

Ends the session and leaves its refresh tokens alive, so an application holding one can obtain a new access token immediately. Use revoke/1 after a credential compromise.

Answers 202.

iex> Auth0Client.Management.Session.delete("sess_abc123")

get(id)

Gets a session

iex> Auth0Client.Management.Session.get("sess_abc123")

revoke(id)

Revokes a session and every refresh token issued under it

The difference from delete/1: this one closes the refresh-token path too, so the user genuinely has to authenticate again.

Answers 202.

iex> Auth0Client.Management.Session.revoke("sess_abc123")

update(id, body)

Updates a session's metadata

session_metadata is the only mutable property, and at least one property must be present. Passing nil or %{} clears the metadata rather than leaving it alone — an explicit null is meaningful here, which is why this library does not prune nils from Management PATCH bodies.

iex> Auth0Client.Management.Session.update("sess_abc123", %{session_metadata: %{device: "laptop"}})
iex> Auth0Client.Management.Session.update("sess_abc123", %{session_metadata: nil})