Skip to main content

verifyToken

chainalign-backend


chainalign-backend / middleware/authMiddleware / verifyToken

Function: verifyToken()

verifyToken(req, res, next): void

Defined in: middleware/authMiddleware.js:25

Verifies the Firebase ID token provided in the Authorization header. If the token is valid, it fetches the user's application-specific data (like tenant_id, roles, and permissions) from the database and attaches it to the req.user object.

This middleware also includes a bypass for testing purposes when BYPASS_AUTH_FOR_TESTING is set to 'true', attaching a mock user object to the request.

Parameters

req

any

The Express request object.

res

any

The Express response object.

next

Function

The Express next middleware function.

Returns

void