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
| Option | Type | Description |
|---|---|---|
| token | string | User 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 tokendata.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 providedERROR/INTERNAL_VERIFICATION: An unexpected error occurred during verificationERROR/INTERNAL_TOKEN_GENERATION: Failed to generate an encrypted tokenERROR/INTERNAL: Communication with the external authentication API failedERROR/FETCH_FAILED: The session validation result was invalid
Last updated on