-
Notifications
You must be signed in to change notification settings - Fork 0
Auth0 Reference Guide
Heindrich Jansen edited this page May 19, 2026
·
1 revision
Auth0 is our Identity Provider (IdP). It handles:
- Storing and verifying passwords securely
- Issuing JWT access tokens
- Managing user identities
We never store passwords in our own database. Auth0 owns that.
When a user logs in, Auth0 issues a JWT (JSON Web Token). This token:
- Is signed with Auth0's private key using RS256
- Contains the user's Auth0 ID (
sub), email, and any custom claims - Expires after 24 hours
- Is verified by the API Gateway using Auth0's public JWKS keys
The token payload looks like this (decoded):
{
"iss": "https://phishshield.us.auth0.com/",
"sub": "auth0|abc123",
"aud": ["https://phishshield-api"],
"email": "user@example.com",
"exp": 1234567890,
"iat": 1234567890
}| Application | Type | Purpose |
|---|---|---|
| PhishShield Accounts Service | Regular Web App | Login and token issuance |
| PhishShield Management | Machine-to-Machine | Creating users via Management API |
URL: https://manage.auth0.com
Tenant: phishshield.us.auth0.com
Contact the backend lead for credentials.
| Variable | Where to get it |
|---|---|
AUTH0_DOMAIN |
Auth0 Dashboard → Settings |
AUTH0_CLIENT_ID |
Regular Web App → Settings |
AUTH0_CLIENT_SECRET |
Regular Web App → Settings |
AUTH0_AUDIENCE |
Auth0 Dashboard → APIs → Identifier |
AUTH0_M2M_CLIENT_ID |
M2M App → Settings |
AUTH0_M2M_CLIENT_SECRET |
M2M App → Settings |
- 25,000 Monthly Active Users
- 1,000 M2M tokens per month (we cache these — one per day)
- Unlimited logins
The gateway uses passport-jwt and jwks-rsa to validate tokens:
- Frontend sends
Authorization: Bearer <token>header - Gateway extracts the token
-
jwks-rsafetches Auth0's public keys from
https://phishshield.us.auth0.com/.well-known/jwks.json - The token signature is verified against the public key
- The audience and issuer are checked
- If valid,
req.useris populated with the token payload - If invalid, a 401 is returned
This means no Auth0 API call is made during validation — it's all done locally using public key cryptography.
To include roles in the JWT, you need an Auth0 Action. Go to:
Auth0 Dashboard → Actions → Flows → Login
Add a custom action:
exports.onExecutePostLogin = async (event, api) => {
const namespace = 'https://phishshield/';
if (event.authorization) {
api.idToken.setCustomClaim(`${namespace}roles`, event.authorization.roles);
api.accessToken.setCustomClaim(`${namespace}roles`, event.authorization.roles);
}
};This adds roles to the JWT which the gateway reads from
payload['https://phishshield/roles'].