89 lines
1.8 KiB
Markdown
89 lines
1.8 KiB
Markdown
## Signin request
|
|
|
|
#### You will need to provide existing account phone number and password in this request
|
|
|
|
```bash
|
|
curl --request POST \
|
|
--url https://api.fenaka.mv/auth/signin \
|
|
--header 'authorization: Bearer TOKEN' \
|
|
--header 'content-type: application/json' \
|
|
--data '{"mobile":"PHONE_NUMBER","password":"PASSWORD"}'
|
|
```
|
|
|
|
## HTTP 200
|
|
```json
|
|
{
|
|
"id": ,
|
|
"name": "",
|
|
"mobile": "",
|
|
"email": "",
|
|
"createdAt": "1970-01-01T00:00:00.000Z",
|
|
"updatedAt": "1970-01-01T00:00:00.000Z",
|
|
"deletedAt": null
|
|
}
|
|
```
|
|
`updatedAt` and `createdAt` are retuned in ISO 8601 with milliseconds and in UTC timezone.
|
|
You will also get a "Set-Cookie" in reponse header, which will be needed for later requests, store this header somewhere for later requests
|
|
|
|
```
|
|
Set-Cookie: connect.sid=; HttpOnly; Path=/; Expires=Mon, 22 Sep 2025 15:24:18 GMT
|
|
```
|
|
(you only need the part before the first ";")
|
|
|
|
## HTTP 401
|
|
```json
|
|
{
|
|
"error": "incorrect credentials"
|
|
}
|
|
```
|
|
This is the response you will get if username or password is not correct
|
|
- reset password
|
|
- register an account
|
|
|
|
## HTTP 422
|
|
Invalid password or invalid phone number
|
|
- Phone number must contain 7 characters and password must contain 8 characters.
|
|
```json
|
|
{
|
|
"errors": [
|
|
{
|
|
"value": "1111",
|
|
"msg": "must be at least 8 characters",
|
|
"param": "password",
|
|
"location": "body"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
- Invalid phone number
|
|
```json
|
|
{
|
|
"errors": [
|
|
{
|
|
"value": "0000",
|
|
"msg": "invalid mobile",
|
|
"param": "mobile",
|
|
"location": "body"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
- Invalid password and phone number
|
|
```json
|
|
{
|
|
"errors": [
|
|
{
|
|
"value": "0000",
|
|
"msg": "invalid mobile",
|
|
"param": "mobile",
|
|
"location": "body"
|
|
},
|
|
{
|
|
"value": "Kee",
|
|
"msg": "must be at least 8 characters",
|
|
"param": "password",
|
|
"location": "body"
|
|
}
|
|
]
|
|
```
|