6. API endpoints - Authentification endpoints 

Page / - last modified by Outhman Moustaghfir on 2021/11/23 14:53 

Authentification endpoints 
last modified by Outhman Moustaghfir
on 2021/11/23 14:53

Table of Contents
Introduction
Validation
Endpoints
Possible errors or exceptions

Introduction
This documentation describes how to get authenticated to the iXPath App.
Validation
The endpoint should verify those points : 
- Encrypt the password with SHA256 algorithms
- Verify if the user's environment is active
- Remove all unnecessary verifications (Env's verification)
- Verify if the user is activated.
- Throw errors 401 and 403 for the authentication failure.
Endpoints
URL [method]	Description	Input example	Output example	
/auth [POST]	generate a token to get access to all other endpoints.	The input data must be placed in the JSON body of the request as the following example :
{
   "user" : "user1",
   "password" : "abcd.12345",
   "env" : "iXPath"
}
NB : "user" and "password" are mandatory.
meanwhile, "env" param could be generated automatically if it is not mentioned or no more active.	{
   "timestamp": 1637162043978,
   "status": "200",
   "data": {
       "Token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsI
mlkIjoiMSIsImVudiI6ImlYUGF0aCIsInRpbWUiOjE2Njg2OTgwNDM
0OTN9.0aiAL7BHTanzm1yrELOOaHonWOqPddaUu26lL1GpAJJ6MPxK9eUta
RAi2m_gV8OhcYhPE_wgu8lESxMevT90YA",
       "Expiration_date": "2022/11/17 16:14:03",
       "Default_env": "iXPath"
    }
}	
Possible errors or exceptions
•	If information is not filled in correctly or the user doesn't exist, the response will look like this example :
1
2
3
4
5
6
{
   "timestamp": 1637164878357,
   "status": "401",
   "error": "the user's information not found : user, password",
   "thechnicalError": "the user's information not found : user, password"
}