first commit
This commit is contained in:
299
Temp/login_register.md
Normal file
299
Temp/login_register.md
Normal file
@@ -0,0 +1,299 @@
|
||||
|
||||
## Example Login Request
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8080/api/v1/auth/login' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"email": "beyhan@beyhan.dev",
|
||||
"password": "1923btO**"
|
||||
}'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/login
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `200 OK`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJhY2Nlc3MiLCJzdWIiOiI2IiwiZXhwIjoxNzcxODI5NTM2LCJpYXQiOjE3NzE4MjIzMzZ9.Rq5XEOjMtE96-UDo2BqscsDEIMCfIwuIrzWAknIeHBA",
|
||||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJyZWZyZXNoIiwic3ViIjoiNiIsImV4cCI6MTc3NDQxNDMzNiwiaWF0IjoxNzcxODIyMzM2fQ.FX4IwpZ5QcVuyWkFRT9QGTjk92GxJMlo2KlnTRBxiI4",
|
||||
"user": {
|
||||
"email": "beyhan@beyhan.dev",
|
||||
"first_name": "Beyhan",
|
||||
"id": 6,
|
||||
"is_admin": true,
|
||||
"last_name": "Oğur",
|
||||
"username": "Beyhan Oğur"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
access-control-allow-credentials: true
|
||||
access-control-allow-headers: Authorization,Content-Type,Accept,Origin,X-Requested-With
|
||||
access-control-allow-methods: GET,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
access-control-allow-origin: http://localhost:8080
|
||||
access-control-max-age: 600
|
||||
content-length: 770
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 04:52:15 GMT
|
||||
vary: Origin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Get Current User ("/me") Request
|
||||
|
||||
```bash
|
||||
curl -X 'GET' \
|
||||
'http://localhost:8080/api/v1/auth/me' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJhY2Nlc3MiLCJzdWIiOiI2IiwiZXhwIjoxNzcxODI5NTM2LCJpYXQiOjE3NzE4MjIzMzZ9.Rq5XEOjMtE96-UDo2BqscsDEIMCfIwuIrzWAknIeHBA'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/me
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `200 OK`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"email": "beyhan@beyhan.dev",
|
||||
"first_name": "Beyhan",
|
||||
"id": 6,
|
||||
"is_admin": true,
|
||||
"last_name": "Oğur"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
content-length: 103
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 04:54:28 GMT
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Refresh Token Request
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8080/api/v1/auth/refresh' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJyZWZyZXNoIiwic3ViIjoiNiIsImV4cCI6MTc3NDQxNDMzNiwiaWF0IjoxNzcxODIyMzM2fQ.FX4IwpZ5QcVuyWkFRT9QGTjk92GxJMlo2KlnTRBxiI4"
|
||||
}'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/refresh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `200 OK`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJhY2Nlc3MiLCJzdWIiOiI2IiwiZXhwIjoxNzcxODI5NzQ3LCJpYXQiOjE3NzE4MjI1NDd9.gw2lmGRfRyuDcicitWXgx0l48FbDWWieWcOrs2McTbw",
|
||||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJlbWFpbCI6ImJleWhhbkBiZXloYW4uZGV2IiwiaXNfYWRtaW4iOnRydWUsImZpcnN0X25hbWUiOiJCZXloYW4iLCJsYXN0X25hbWUiOiJPxJ91ciIsInRva2VuX3R5cGUiOiJyZWZyZXNoIiwic3ViIjoiNiIsImV4cCI6MTc3NDQxNDU0NywiaWF0IjoxNzcxODIyNTQ3fQ.9soEk6LvbG-BjV5fcmyu5MQMaerq7PT8QUXsqIasoF4"
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
access-control-allow-credentials: true
|
||||
access-control-allow-headers: Authorization,Content-Type,Accept,Origin,X-Requested-With
|
||||
access-control-allow-methods: GET,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
access-control-allow-origin: http://localhost:8080
|
||||
access-control-max-age: 600
|
||||
content-length: 642
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 04:55:46 GMT
|
||||
vary: Origin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Register Request
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8080/api/v1/auth/register' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"email": "string@strind.com",
|
||||
"first_name": "string",
|
||||
"last_name": "string",
|
||||
"password": "string",
|
||||
"username": "string"
|
||||
}'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/register
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `201 Created`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "registration successful, please verify your email before login",
|
||||
"user": {
|
||||
"email": "string@strind.com",
|
||||
"email_verified": false,
|
||||
"first_name": "string",
|
||||
"id": 47,
|
||||
"is_admin": false,
|
||||
"last_name": "string",
|
||||
"username": "string"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
access-control-allow-credentials: true
|
||||
access-control-allow-headers: Authorization,Content-Type,Accept,Origin,X-Requested-With
|
||||
access-control-allow-methods: GET,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
access-control-allow-origin: http://localhost:8080
|
||||
access-control-max-age: 600
|
||||
content-length: 224
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 04:56:57 GMT
|
||||
vary: Origin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Resend Verification Email Request
|
||||
|
||||
```bash
|
||||
curl -X 'POST' \
|
||||
'http://localhost:8080/api/v1/auth/resend-verification' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"email": "string@strind.com"
|
||||
}'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/resend-verification
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `200 OK`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "verification email has been sent"
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
access-control-allow-credentials: true
|
||||
access-control-allow-headers: Authorization,Content-Type,Accept,Origin,X-Requested-With
|
||||
access-control-allow-methods: GET,POST,PUT,PATCH,DELETE,OPTIONS
|
||||
access-control-allow-origin: http://localhost:8080
|
||||
access-control-max-age: 600
|
||||
content-length: 46
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 04:59:08 GMT
|
||||
vary: Origin
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Verify Email Request
|
||||
|
||||
```bash
|
||||
curl -X 'GET' \
|
||||
'http://localhost:8080/api/v1/auth/verify-email?token=8e89c1ad1e52453894bd1a4bdd2ca9ac1f27d3f862f5dc9858ae5412e31d409e' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
**Request URL**
|
||||
|
||||
```
|
||||
http://localhost:8080/api/v1/auth/verify-email?token=8e89c1ad1e52453894bd1a4bdd2ca9ac1f27d3f862f5dc9858ae5412e31d409e
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Example Successful Response
|
||||
|
||||
**HTTP Status Code:** `200 OK`
|
||||
|
||||
**Response Body:**
|
||||
|
||||
```json
|
||||
{
|
||||
"message": "email verified successfully"
|
||||
}
|
||||
```
|
||||
|
||||
**Response Headers:**
|
||||
|
||||
```
|
||||
content-length: 41
|
||||
content-type: application/json; charset=utf-8
|
||||
date: Mon,23 Feb 2026 05:00:13 GMT
|
||||
```
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user