AuthN | Node SDK | Session Endpoints
Session Endpoints
Invalidate Session | Client
invalidate(token: string, sessionID: string): Promise<PangeaResponse<{}>>Invalidate a session by session ID using a client token.
await authn.client.session.invalidate(
"ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
"pmt_zppkzrjguxyblaia6itbiesejn7jejnr"
);
List sessions (client token)
list(token: string, options: ListOptions): Promise<PangeaResponse<ListResult>>List sessions using a client token.
const response = await authn.client.session.list(
"ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a",
{ order_by: "id" }
);
Log out (client token)
logout(token: string): Promise<PangeaResponse<{}>>Log out the current user's session.
await authn.client.session.logout(
"ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a"
);
Refresh a Session
refresh(refreshToken: string, options: RefreshOptions): Promise<PangeaResponse<RefreshResult>>Refresh a session token.
const response = await authn.client.session.refresh(
"ptr_xpkhwpnz2cmegsws737xbsqnmnuwtbm5",
{ user_token: "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a" }
);
Invalidate Session
invalidate(sessionID: string): Promise<PangeaResponse<{}>>Invalidate a session by session ID.
await authn.session.invalidate(
"pmt_zppkzrjguxyblaia6itbiesejn7jejnr"
);
List session (service token)
list(request: ListRequest): Promise<PangeaResponse<ListResult>>List sessions.
const response = await authn.session.list({
order: "desc",
order_by: "created_at"
});
Log out (service token)
logout(user_id: string): Promise<PangeaResponse<{}>>Invalidate all sessions belonging to a user.
await authn.session.logout(
"pui_xpkhwpnz2cmegsws737xbsqnmnuwtvm5"
);