The noonjs authentication system provides a customizable login API that supports flexible field names such as username and password. These can be configured in the config.json file. The login endpoint authenticates users by verifying credentials and issuing access tokens.
POST /auth/login
{
"email": "user@example.com",
"password": "securePassword123"
}When a user logs in, noonjs verifies the provided credentials against the stored hashed password. If authentication is successful, a JWT access token is generated, allowing secure API interactions.
{
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}The generated access token should be included in the authorization header for subsequent requests.Like the registration process, login field names such as username and password can be adapted based on the config.json settings. For example, if the configuration specifies username as "mobile" and password as "pin", the login request would look like this:
POST /auth/login
{
"mobile": "+1234567890",
"pin": "securePin123"
}This flexibility allows developers to match authentication fields to their application’s specific needs.