Authentication success, Returns an access token, user details, and expiry information.
fetch('https://fake.jsonmockapi.com/auth/login', {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "user@example.com",
password: "Password123"
})
})
.then(response => response.json())
.catch(error => console.error('Error:', error));
Authentication failed. Returns a failure response with any custom status code appended after auth/login/{statusCode} in the route
fetch('https://fake.jsonmockapi.com/auth/login/401', {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "user@example.com",
password: "unkown"
})
})
.then(response => response.json())
.catch(error => console.error('Error:', error));