Skip to main content

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.

required parameters

string

A user token value

string

An ID for a token

Response Object

Promise<PangeaResponse<{}>>
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.

required parameters

string

A user token value

Supported options:

  • filter (object): A filter object
  • last (string): Reflected value from a previous response to obtain the next page of results.
  • order (string): Order results asc(ending) or desc(ending).
  • order_by (string): Which field to order results by. One of: id, created_at, type, identity, email, expire, active_token_id
  • size (integer): Maximum results to include in the response. Minimum is 1.

Response Object

Promise<PangeaResponse<ListResult>>
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.

required parameters

string

A user token value

Response Object

Promise<PangeaResponse<{}>>
await authn.client.session.logout(
  "ptu_wuk7tvtpswyjtlsx52b7yyi2l7zotv4a"
);

Refresh a Session

refresh(refreshToken: string, options: RefreshOptions): Promise<PangeaResponse<RefreshResult>>

Refresh a session token.

required parameters

string

A refresh token value

Supported options:

  • user_token (string): A user token value

Response Object

Promise<PangeaResponse<RefreshResult>>
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.

required parameters

string

An ID for a token

Response Object

Promise<PangeaResponse<{}>>
await authn.session.invalidate(
  "pmt_zppkzrjguxyblaia6itbiesejn7jejnr"
);

List session (service token)

list(request: ListRequest): Promise<PangeaResponse<ListResult>>

List sessions.

required parameters

ListRequest

An object of options:

  • filter (object): A filter object
  • last (string): Reflected value from a previous response to obtain the next page of results.
  • order (string): Order results asc(ending) or desc(ending).
  • order_by (string): Which field to order results by. One of: id, created_at, type, identity, email, expire, active_token_id
  • size (integer): Maximum results to include in the response. Minimum is 1.

Response Object

Promise<PangeaResponse<ListResult>>
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.

required parameters

string

The identity of a user or a service

Response Object

Promise<PangeaResponse<{}>>
await authn.session.logout(
  "pui_xpkhwpnz2cmegsws737xbsqnmnuwtvm5"
);