- Do minimal required work, which results in next decisions
- Use Node.js v22 with TypeScript Type Stripping feature for development and testing
- Test using Node.js build-in module
- Use
jose
for working with JWT - Use
dotenv-flow
for environment variables
- By the task authorize route don't make any authentication process (for example login via email/password). It doesn't make sense in real world
- There no protection against refresh token stealing
- Of course I can do better, refactor code, make it more safe etc, but I don't want to spend more time and the task doesn't require it
You firstly need to add .env.test
file a least the following lines to be able to check token or code expiration
AUTH_CODE_EXPIRY=3
ACCESS_TOKEN_EXPIRY=3
REFRESH_TOKEN_EXPIRY=3