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

Token Verification

You can verify the validity of an encrypted token and retrieve the username by calling the extractUserWithVerify() method.


How to Verify the Encrypted Token

src/index.ts
.("/verify", async () => { const = ..("token"); const = await .(); if (.) { return .(); } else { return .(); } });

If the token is valid, a response like the following will be returned:

Response
{ "success": true, "data": "***********" }

Internal Behavior of Verification

extractUserWithVerify() checks the following conditions:

  • Whether a token is provided
  • Whether the token has been tampered with

Authentication is only considered successful if all conditions are met.


Error Examples and Solutions

Error MessageCauseSolution
Token not providedToken argument is missingAdd the token argument
Invalid token formatFormat is incorrectEnsure the token hasn’t been altered
Last updated on