Clerk.Session (Clerk SDK v2.0.0)
Session handles the JWT validation and decoding.
Usage
Clerk.Session.verify_and_validate!(jwt)
%{
"azp" => "https://example.accounts.dev",
"exp" => 1706308195,
"iat" => 1706308135,
"iss" => "https://example.clerk.accounts.dev",
"nbf" => 1706308125,
"sid" => "sess_2bVftP1rQemOu4CPj9999999999",
"sub" => "user_2bVftRtFezPdchfaz9999999999"
}When running multiple Clerk tenants, pass the same %Clerk.Config{} used to
start the supervisor:
Clerk.Session.verify_and_validate(jwt, config: config)
Summary
Functions
Creates a JSON Web Token(JWT) based on a session and a JWT Template name defined for your instance
Retrieve the details of a session
The Session object is an abstraction over an HTTP session. It models the period of information exchange between a user and the server. Sessions are created when a user successfully goes through the sign in or sign up flows.
Sets the status of a session as "revoked", which is an unauthenticated state. In multi-session mode, a revoked session will still be returned along with its client object, however the user will need to sign in again.
Functions
create_session_from_jwt_template(session_id, jwt_template, opts \\ [])
Creates a JSON Web Token(JWT) based on a session and a JWT Template name defined for your instance
get(id, opts \\ [])
Retrieve the details of a session
list(params, opts \\ [])
The Session object is an abstraction over an HTTP session. It models the period of information exchange between a user and the server. Sessions are created when a user successfully goes through the sign in or sign up flows.
https://clerk.com/docs/reference/clerkjs/session
QUERY PARAMETERS
client_id
string List sessions for the given client
user_id
string List sessions for the given user
status
string Filter sessions by the provided status
Enum: "abandoned" "active" "ended" "expired" "removed" "replaced" "revoked"
limit
number [ 1 .. 500 ] Default: 10 Applies a limit to the number of results returned. Can be used for paginating the results together with offset. Must be an integer greater than zero and less than 500. By default, if not supplied, a limit of 10 is used.
offset
number >= 0 Default: 0 Skip the first offset results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit.
revoke(id, opts \\ [])
Sets the status of a session as "revoked", which is an unauthenticated state. In multi-session mode, a revoked session will still be returned along with its client object, however the user will need to sign in again.