User login
Request description
Endpoint: /users/login
Method: POST
Header
{
"Content-Type": "application/json"
}
Payload example
{
"email": "mock@mock.com",
"password": "mock-password"
}
Payload structure
interface ILoginPayload {
email: string; //Email related to the user who performs the authentication
password: string; //Password related to the user who performs the authentication
}
Responses
Correct response
Successful authentication
Describe a successful login action
200
Response body example:
{
"isSuccess": true,
"accessToken": "mock-access-token",
"accounts": [
{
"id": "mock-user-account-id",
"userId": "mock-user-id",
"organizationId": "mock-organization-id",
"userType": "mock-user-type",
"organizationName": "mock-organization-name",
"isSelected": "true",
"groupId": "mock-group-id",
"customSubdomain": "mock-custom-subdomain"
}
],
"userId": "mock-user-id",
"fullName": "Mock User Name"
}
interface ILoginResponse {
isSuccess: boolean;
accessToken?: string;
accounts?: IUserAccount[];
userId?: string;
fullName?: string;
}
interface IUserAccount {
id: string;
userId: string;
organizationId: string;
userType: string;
organizationName: string;
isSelected: boolean;
groupId: string;
customSubdomain: string;
}
Wrong Authentication
Describe an unsuccessful login action
200
Response structure
type AuthenticationResponseType = {
isSuccess: boolean, // Specifies the authentication status
errorMessage: string, //Specifies the error message
errorType: ErrorType // Specifies the error type
}
enum ErrorType = {
UNAUTHORIZED= "unauthorized"
}
Additional notes:
1. The accessToken is valid for one hour
2. It must be ensured that the access credentials used belong to a user who is ready to use the platform.
3. You must ensure that the credentials belong to a user with the Organization Owner or Organization Admin role.
1. The accessToken is valid for one hour
2. It must be ensured that the access credentials used belong to a user who is ready to use the platform.
3. You must ensure that the credentials belong to a user with the Organization Owner or Organization Admin role.
Wrong responses
Bad request
Describe an invalid request
400
Response structure
type AuthenticationResponseType = {
isSuccess: boolean, // Specifies the authentication status
errorMessage: string, // Specifies the error message
errorType: LoginErrorType // Specifies the error type
}
enum LoginErrorType = {
MISSING_REQUIRED_FIELDS = "missingRequiredFields",
INVALID_REQUEST_FORMAT = "invalidRequestFormat"
}