password_reset docs incomplete
This commit is contained in:
59
docs/password_reset.md
Normal file
59
docs/password_reset.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
## Password reset
|
||||||
|
|
||||||
|
|
||||||
|
## Request for OTP
|
||||||
|
#### You will need to provide existing account phone number in this request
|
||||||
|
```bash
|
||||||
|
curl --request POST \
|
||||||
|
--url https://api.fenaka.mv/auth/password-reset/request \
|
||||||
|
--header 'authorization: Bearer TOKEN' \
|
||||||
|
--header 'content-type: application/json' \
|
||||||
|
--data '{"mobile":"PHONE_NUMBER"}'
|
||||||
|
```
|
||||||
|
- This should send a 1 digit OTP to phone number you requested, but at the time of writing this document fenaka SMS seems to be broken
|
||||||
|
|
||||||
|
You will also get a "Set-Cookie" in reponse header, which will be needed for submitting OTP, store this header somewhere for later user
|
||||||
|
```
|
||||||
|
Set-Cookie: connect.sid=; HttpOnly; Path=/```
|
||||||
|
(you only need the part before the first ";")
|
||||||
|
|
||||||
|
## HTTP 200
|
||||||
|
- You will just the requested phone number in json
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mobile": ""
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## HTTP 404
|
||||||
|
- You will get this reponse if there is no registered account
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "not-found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
## Submit OTP
|
||||||
|
|
||||||
|
I CANNOT TEST THIS AT THE TIME OF WRITING THIS DOCUMENT BECAUSE SMS IS NOT WORKING \
|
||||||
|
but here is how to:
|
||||||
|
```bash
|
||||||
|
curl --request POST \
|
||||||
|
--url https://api.fenaka.mv/auth/verify-otp/password-reset \
|
||||||
|
--header 'authorization: Bearer TOKEN' \
|
||||||
|
--header 'content-type: application/json' \
|
||||||
|
--data '{"otp":"1111"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
## HTTP 422
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"value": "1111",
|
||||||
|
"msg": "invalid otp",
|
||||||
|
"param": "otp",
|
||||||
|
"location": "body"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
Reference in New Issue
Block a user