Skip to Content
This project is in active development. Features and behaviors may change without notice.

verifySession

Type: verifySession(content?: string): Promise<APIResult<verifySessionResponse>>

verifySession() verifies the token provided for the user’s session. If it matches the expected redirect destination, the session is considered valid. A secure encrypted token is then returned.

TypeScript
const = await .().(token); if (.) { .("Authentication succeeded:", .); } else { .("Error:", .); }

Parameters

OptionTypeDescription
tokenstringUser session token received from the authentication server

Return Value

  • Promise<APIResult<verifySessionResponse>>: An object containing session validity and the resulting secure token.
    • data.token: The encrypted session ID token
    • data.payload: Information about the original session (e.g., username)

Example Usage

TypeScript
const = "received-session-token"; const = await .().(); if (.) { const = ..; .("Secure Token:", ); }

Error Response Codes

  • ERROR/ARGUMENT_REQUIRED_SESSION: No session token was provided
  • ERROR/INTERNAL_VERIFICATION: An unexpected error occurred during verification
  • ERROR/INTERNAL_TOKEN_GENERATION: Failed to generate an encrypted token
  • ERROR/INTERNAL: Communication with the external authentication API failed
  • ERROR/FETCH_FAILED: The session validation result was invalid
Last updated on