Repository navigation
Authentication API Documentation
This document provides documentation for the Authentication API endpoints available in the Points.Api system.
The Points.Api system uses a two-step authentication process:
- API Key Authentication: Initial authentication is done using an API key provided in the request header.
- JWT Token Authentication: After successful API key authentication, a JWT token is issued which is used for subsequent requests.
Generates a JWT token for authenticated API clients.
URL: /api/Authentication/getauthtoken
Method: GET
Auth required: Yes (API Key Authentication)
Headers:
-
apikey(string) - The API key associated with a partner
Success Response:
- Code: 200 OK
- Content: JWT token
Error Response:
- Code: 401 Unauthorized
- Content: Error message
Example Request:
GET /api/Authentication/getauthtoken HTTP/1.1
Host: your-api-domain.com
apikey: your-partner-api-keyExample Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}The authentication process is handled by a custom AuthenticationHandler that validates API keys against partner records in the database.
- The client includes an API key in the request header (
apikey). - The
AuthenticationHandlervalidates the API key against the list of registered partners. - If valid, the handler creates a
ClaimsPrincipalwith claims for:-
PartnerId: The ID of the partner -
PartnerName: The name of the partner
-
- The
Authenticationcontroller then uses these claims to generate a JWT token. - The client uses this JWT token for subsequent API requests.
The JWT token generated by the system has the following characteristics:
- Algorithm: HMAC SHA-256 (HS256)
-
Issuer: Configured in application settings (
Jwt_Issuer) - Expiration: 5 minutes from issuance
-
Claims:
-
PartnerId: The ID of the partner -
PartnerName: The name of the partner
-
After obtaining a JWT token, include it in the Authorization header of subsequent requests:
Authorization: Bearer {your_jwt_token}
The token will be valid for 5 minutes, after which a new token must be obtained.
- API keys should be kept secure and not exposed in client-side code.
- JWT tokens have a short expiration time (5 minutes) to minimize the risk of token theft.
- All API communications should be over HTTPS to prevent interception of tokens.
- Frequently Asked Questions
-
EZ Loyalty Points Api
- Authorization
- Summary
- End Points
- Branding End Points
- Buckets End Points
- Competition End Points
- Country End Points
- Leader Boards End Points
- Machine Learning End Points
- Partner Activities End Points
- Partner End Points
- Partner FAQs End Points
- Partner Level Points End Points
- Reward Points End Points
- Subscriptions End Points
- Users End Points
- User Points End Points
- EZ Loyalty Admin Api