-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
497 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Now | ||
- dont's show oh, sorry! for directories without index.md | ||
- current dir | ||
- readme | ||
- screenshot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,263 @@ | ||
# /profiles/me | ||
|
||
## Get authenticated user's profile | ||
|
||
### GET /profiles/me | ||
|
||
### Request Headers | ||
|
||
* Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 200 OK | ||
|
||
#### Headers | ||
|
||
* content-length: 232 | ||
|
||
#### Body | ||
|
||
Content-Type: application/json | ||
|
||
```json | ||
{"nickname":"god","nickname_isdirty":true,"timezone":"00:00","locale":null,"avatar":null,"roles":["god"],"created_at":"2024-08-22T03:30:00","modified_at":"2024-08-22T03:30:00","id":1,"email":"[email protected]","name":"God","phone":null} | ||
``` | ||
|
||
--- | ||
|
||
## WHEN: Authorization header is not passed | ||
|
||
### GET /profiles/me | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 401 Unauthorized | ||
|
||
#### Headers | ||
|
||
* content-length: 703 | ||
|
||
--- | ||
|
||
## WHEN: User is already deleted | ||
|
||
### GET /profiles/me | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 404 Not Found | ||
|
||
#### Headers | ||
|
||
* content-length: 1160 | ||
|
||
## Updating profile by the owner | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
name | ? | ? | Bob | ||
phone | ? | ? | +98 (912) 111 1111 | ||
|
||
### Request Headers | ||
|
||
* Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "name=Bob" -F "phone=+98 (912) 111 1111" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 200 OK | ||
|
||
#### Headers | ||
|
||
* content-length: 248 | ||
|
||
#### Body | ||
|
||
Content-Type: application/json | ||
|
||
```json | ||
{"nickname":"god","nickname_isdirty":true,"timezone":"00:00","locale":null,"avatar":null,"roles":["god"],"created_at":"2024-08-22T03:30:00","modified_at":"2024-08-22T03:30:00","id":1,"email":"[email protected]","name":"Bob","phone":"+98 (912) 111 1111"} | ||
``` | ||
|
||
--- | ||
|
||
## WHEN: Short nickname | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
nickname | ? | ? | | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "nickname=" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 701 nickname: Length must be between 1 and 12 characters | ||
|
||
#### Headers | ||
|
||
* content-length: 1077 | ||
|
||
--- | ||
|
||
## WHEN: Long nickname | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
nickname | ? | ? | xxxxxxxxxxxxx | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "nickname=xxxxxxxxxxxxx" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 701 nickname: Length must be between 1 and 12 characters | ||
|
||
#### Headers | ||
|
||
* content-length: 1077 | ||
|
||
--- | ||
|
||
## WHEN: Update nickname | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
nickname | ? | ? | Bob | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "nickname=Bob" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 200 OK | ||
|
||
#### Headers | ||
|
||
* content-length: 249 | ||
|
||
#### Body | ||
|
||
Content-Type: application/json | ||
|
||
```json | ||
{"nickname":"Bob","nickname_isdirty":false,"timezone":"00:00","locale":null,"avatar":null,"roles":["god"],"created_at":"2024-08-22T03:30:00","modified_at":"2024-08-22T03:30:00","id":1,"email":"[email protected]","name":"Bob","phone":"+98 (912) 111 1111"} | ||
``` | ||
|
||
--- | ||
|
||
## WHEN: Update locale | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
locale | ? | ? | en-US | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "locale=en-US" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 200 OK | ||
|
||
#### Headers | ||
|
||
* content-length: 252 | ||
|
||
#### Body | ||
|
||
Content-Type: application/json | ||
|
||
```json | ||
{"nickname":"Bob","nickname_isdirty":false,"timezone":"00:00","locale":"en-US","avatar":null,"roles":["god"],"created_at":"2024-08-22T03:30:00","modified_at":"2024-08-22T03:30:00","id":1,"email":"[email protected]","name":"Bob","phone":"+98 (912) 111 1111"} | ||
``` | ||
|
||
--- | ||
|
||
## WHEN: Update timezone | ||
|
||
### UPDATE /profiles/me | ||
|
||
### Form | ||
|
||
Name | Required | Type | Example | ||
--- | --- | --- | --- | ||
timezone | ? | ? | +03:30 | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "timezone=+03:30" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 200 OK | ||
|
||
#### Headers | ||
|
||
* content-length: 253 | ||
|
||
#### Body | ||
|
||
Content-Type: application/json | ||
|
||
```json | ||
{"nickname":"Bob","nickname_isdirty":false,"timezone":"+03:30","locale":"en-US","avatar":null,"roles":["god"],"created_at":"2024-08-22T03:30:00","modified_at":"2024-08-22T03:30:00","id":1,"email":"[email protected]","name":"Bob","phone":"+98 (912) 111 1111"} | ||
``` | ||
|
||
--- | ||
|
||
## WHEN: Member deleted | ||
|
||
### UPDATE /profiles/me | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -X UPDATE -F "name=Bob" -F "phone=+98 (912) 111 1111" -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZXhwIjoxNzI0Mjg4NDAwLCJuaWNrbmFtZSI6ImdvZCIsInRpbWV6b25lIjoiMDA6MDAiLCJsb2NhbGUiOm51bGwsImF2YXRhciI6bnVsbCwicm9sZXMiOlsiZ29kIl19.oLfFxr1QNLYSfg-XDEc94-pFpXSzGCvjN0In58SH-kc" -- "$URL/profiles/me" | ||
``` | ||
|
||
### Response: 404 Not Found | ||
|
||
#### Headers | ||
|
||
* content-length: 1163 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# /tokens/google/cb | ||
|
||
## Redirect back from google oauth2.0 server and login | ||
|
||
### GET /tokens/google/cb | ||
|
||
### Query Strings | ||
|
||
Name | Example | ||
--- | --- | ||
code | 4/0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg | ||
scope | email+profile+https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/userinfo.profile+openid | ||
state | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0 | ||
|
||
### Request Headers | ||
|
||
* Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574 | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574" -- "$URL/tokens/google/cb?code=4%2F0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg&scope=email%2Bprofile%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%2Bopenid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0" | ||
``` | ||
|
||
### Response: 302 Found | ||
|
||
#### Headers | ||
|
||
* location: http://localhost:8080 | ||
* set-cookie: yhttp-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwicmVmcmVzaCI6dHJ1ZSwiZXhwIjoxNzI3MjkwMjIyLCJyb2xlcyI6WyJnb2QiXX0.vAXoLxsLp8TnwZV5O50IPoiOU2T9LXw2GdO-FTV-T_Y; HttpOnly; Max-Age=2592000; Path=/tokens/google/cb; SameSite=Strict; Secure | ||
* content-length: 0 | ||
|
||
--- | ||
|
||
## WHEN: Login again | ||
|
||
### GET /tokens/google/cb | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574" -- "$URL/tokens/google/cb?code=4%2F0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg&scope=email%2Bprofile%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%2Bopenid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0" | ||
``` | ||
|
||
### Response: 302 Found | ||
|
||
#### Headers | ||
|
||
* location: http://localhost:8080 | ||
* set-cookie: yhttp-refresh-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwicmVmcmVzaCI6dHJ1ZSwiZXhwIjoxNzI3MjkwMjIyLCJyb2xlcyI6WyJnb2QiXX0.vAXoLxsLp8TnwZV5O50IPoiOU2T9LXw2GdO-FTV-T_Y; HttpOnly; Max-Age=2592000; Path=/tokens/google/cb; SameSite=Strict; Secure | ||
* content-length: 0 | ||
|
||
--- | ||
|
||
## WHEN: Google say 403 during key exchange | ||
|
||
### GET /tokens/google/cb | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574" -- "$URL/tokens/google/cb?code=4%2F0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg&scope=email%2Bprofile%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%2Bopenid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0" | ||
``` | ||
|
||
### Response: 401 Unauthorized | ||
|
||
#### Headers | ||
|
||
* content-length: 846 | ||
|
||
--- | ||
|
||
## WHEN: Google say 400 during key exchange | ||
|
||
### GET /tokens/google/cb | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574" -- "$URL/tokens/google/cb?code=4%2F0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg&scope=email%2Bprofile%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%2Bopenid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0" | ||
``` | ||
|
||
### Response: 401 Unauthorized | ||
|
||
#### Headers | ||
|
||
* content-length: 846 | ||
|
||
--- | ||
|
||
## WHEN: Token received from google is malformed | ||
|
||
### GET /tokens/google/cb | ||
|
||
### CURL | ||
|
||
```bash | ||
curl -H "Cookie: yhttp-csrf-token=3faad4446b01ce34cb98c4f29ed5a0520d414f002efc6953ba725d5cdb0ce574" -- "$URL/tokens/google/cb?code=4%2F0AX4XfWitAl4eZ2U7eJ7CYbFgl0HrKjUxrAuD5TiXfOV1ZHfcSWjxM1u6z_w8IZMXlLuJLg&scope=email%2Bprofile%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%2Bhttps%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%2Bopenid&state=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjQ2OTgyODIsInJlZHVybCI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODA4MCIsImlkIjoiM2ZhYWQ0NDQ2YjAxY2UzNGNiOThjNGYyOWVkNWEwNTIwZDQxNGYwMDJlZmM2OTUzYmE3MjVkNWNkYjBjZTU3NCJ9.pkQ_qK19cDEJAWScWlGnyPijPRu0J-_TOOIGP1aXRi0" | ||
``` | ||
|
||
### Response: 401 Unauthorized | ||
|
||
#### Headers | ||
|
||
* content-length: 846 | ||
|
Oops, something went wrong.