How would you implement a middleware in Express that checks the Authorization header for a JWT and returns 401 if it's missing or invalid?
What happens if the token signature verification fails? How would your code respond?
If a client sends a token that is expired, how would you detect that and what response would you send?
We need to add role‑based access to a protected route. How would you extend your JWT verification logic to enforce that only users with the 'admin' claim can call the endpoint?
During testing you notice that some valid tokens are being rejected after a recent deployment. What are possible reasons and how would you debug the issue?
Explain the trade‑offs between verifying the token on every request versus caching the decoded payload in memory.
At scale we have thousands of requests per second. How would you design the token verification component to minimize latency and avoid a single point of failure?
Discuss how you would handle key rotation for JWT signing keys without breaking existing clients.
If we need to support token revocation (e.g., logout), what patterns could you use and what are their performance implications?
Our platform is moving from a monolith to microservices, each service needs to validate JWTs issued by a central auth server. How would you design a shared verification library or service to ensure consistency and observability across teams?
Consider a scenario where we have legacy services that only understand opaque session IDs. How would you plan a migration strategy to JWTs while maintaining backward compatibility?
What governance and security policies would you put in place to audit JWT usage across the organization, and how would you enforce them in CI/CD pipelines?