Authentication
Authentication
The NMS API Platform uses JSON Web Token (JWT) authentication. Every request (except health checks) must include a valid token in the Authorization header.
Authentication Flow
1. Obtain a Token
Response:
2. Use the Token
Include the token in every request:
3. Verify Your Identity
Use the /api/v1/auth/me endpoint to confirm your token is valid and inspect your user profile:
GET /api/v1/auth/me Response
Token Expiry & Refresh
Tokens expire after the duration specified in the expiresIn field (in seconds). There is no refresh token mechanism — you must re-authenticate by calling the login endpoint again.
Best practices:
- Cache the token and reuse it until it expires
- If you receive a
401 Unauthorizedresponse, re-authenticate - Do not hardcode tokens — always obtain them at runtime
Roles & Permissions
Access to API endpoints is governed by the roles assigned to your user account. The roles field in the /api/v1/auth/me response indicates your permission level.
Endpoints Without Authentication
The following endpoints do not require a JWT token:
GET /actuator/health— API Gateway health checkGET http://localhost:8081/actuator/health— Auth Service health checkGET http://localhost:8083/actuator/health— Order Service health check
