The “Usher” Analogy
To understand why verification is necessary, think of OTP Edge like a theater:- The Box Office (
/verify-otp): You give them the OTP code, and they give you a Ticket (the Identity Token). - The Usher (Your Backend): The Box Office is outside. To get to the user’s data (the seat), you must show the Ticket to the Usher.
- The Check: If the Usher doesn’t check the signature on the ticket, anyone could walk in with a fake piece of paper and claim to be a valid user.
Standard Verification Flow
OTP Edge uses the RS256 algorithm. We provide a JWKS (JSON Web Key Set) endpoint that allows your application to fetch and cache our public keys automatically.Verification Examples
Handling Token Expiration
OTP Edge Identity Tokens are intentionally short-lived (valid for exactly 10 minutes from the time the OTP is verified). This narrow window ensures that if a token is intercepted, it cannot be used indefinitely. If your backend verification fails with aTokenExpiredError (or equivalent in your library), the identity token is no longer valid.
Recommended Retry Flow:
- Do NOT accept the token: Deny access to the protected route.
- Prompt for Re-authentication: Redirect the user back to your login/verification screen.
- Re-trigger OTP: The user must request a new OTP code to generate a fresh identity token.
Security Checklist
- Backend Only: Verification must ONLY happen on your secure backend server.
- Verify Issuer: Ensure the
issclaim matchesotpedge.com. - Check Expiration: Verify the
expclaim to ensure the token has not expired. Most JWT libraries (likejoseorPyJWT) handle this automatically during verification.