Request
POST /api/auth/login
Request Body
email (required, string, "[email protected]") - The unique identifier of the user
@gmail.compassword (required, string, 12345678) - The unique password of the user
isTeacher (required, boolean, true/false) - Identify is the user is signing in as student or teacherExample Request in Javascript using fetch
const response = await fetch("<https://api.icequeb.site/api/auth/login>", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"email": "[email protected]",
"password": "123456789",
"isTeacher": false
})
});
Response
200 if login is successful (ok)400 if email or password does not exist or email is not valid (bad request)400 if user is not found in the database (bad request)401 if user’s password is not incorrect (unauthorized)429 if user sends 20 request within 5 minutes (too many request)Successful Response Body
{
"email": "[email protected]",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
"status": "success",
"isTeacher": false
}
email (string) - The unique identifier of the usertoken (string) - a json web token used to maintain user’s state between multiple requestsstatus (string) - indicated the request is successful if success is shown