Auth Return uses JWT (JSON Web Tokens) for secure, stateless authentication. This page explains how tokens work, why they're secure, and how you can trust them.
A JWT token is a compact, URL-safe string that contains encoded information about a user.
It consists of three parts separated by dots (.):
header.payload.signature
When a user successfully logs in or signs up, Auth Return generates a JWT token containing:
user_id: Unique identifier for the useremail: User's email addressiat: "Issued at" timestamp (when the token was created)exp: Expiration timestamp (30 days from creation)The token is then cryptographically signed using a secret key that only Auth Return knows. This signature is what makes the token secure and trustworthy.
Tokens are signed using the HS256 algorithm (HMAC-SHA256), which creates
a cryptographic signature based on:
If anyone tries to modify the token (e.g., change the user ID or email), the signature will no longer match, and the token will be rejected as invalid.
Because tokens are cryptographically signed, any modification to the payload (user ID, email, etc.) will invalidate the signature. When a service verifies the token, it recalculates the signature and compares it to the one in the token. If they don't match, the token is rejected.
Tokens expire after 30 days. This limits the window of vulnerability if a token is somehow compromised. Expired tokens cannot be used, even if they have a valid signature.
Unlike session-based authentication, tokens don't require server-side storage. The token itself contains all the information needed to verify it. This makes the system more scalable and eliminates the need for a shared session store.
When a third-party service (like Bright Wrapper) receives a token, it can verify the token's authenticity by:
/api/user endpoint, which verifies the signature using the secret key.
Important: The secret key used to sign tokens is never shared with third-party services. Only Auth Return can generate valid tokens, and only Auth Return can verify them. This means:
/api/user endpoint
Tokens can be refreshed if they're within 7 days of expiration. This allows
users to stay logged in without interruption. The refresh endpoint (/api/refresh)
validates the current token and issues a new one with a fresh 30-day expiration.
localStorage or sessionStorage
in the browser, or secure storage in mobile apps.
POST /api/login - Login and receive a tokenPOST /api/signup - Sign up and receive a tokenGET /api/user?token=... - Verify token and get user infoPOST /api/refresh - Refresh an expiring tokenGET /api/verify?token=... - Verify token validityFor technical implementation details, see the API documentation.