194 lines
5.2 KiB
Markdown
194 lines
5.2 KiB
Markdown
once login ve registeri yapalim
|
||
frontend
|
||
Proje `frontend` klasörü altında yapılandırılmıştır. Gerekli tüm paketler (`package.json`) önceden yüklenmiştir:
|
||
- **Framework:** Next.js 16 (App Router)
|
||
- **UI:** React 19, Tailwind CSS v4, shadcn/ui
|
||
- **İkonlar:** lucide-react
|
||
- **Validasyon:** Zod
|
||
- **Auth:** NextAuth.js
|
||
- **Bildirimler:** SweetAlert2
|
||
- **Güvenlik:** nextjs-turnstile (Cloudflare)
|
||
|
||
Login Backend
|
||
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
|
||
|
||
Server response
|
||
Code Details
|
||
200
|
||
Response body
|
||
Download
|
||
|
||
{
|
||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzEzNzA1NzcsImlhdCI6MTc3MTM1OTc3NywiaXNfYWRtaW4iOnRydWUsInN1YiI6MiwidG9rZW5fdHlwZSI6ImFjY2VzcyJ9.zBCWJlsJxOvB4EzGn5ReutjocF884kJjFsPojbMCWiY",
|
||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzY1NDM3NzcsImlhdCI6MTc3MTM1OTc3Nywic3ViIjoyLCJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.1ASz8UcbuWY7zKRipoFuHbpTBcBMWEbp4TuNKlFffmA",
|
||
"user": {
|
||
"id": 2,
|
||
"username": "beyhan",
|
||
"email": "beyhan@beyhan.dev",
|
||
"email_verified": true,
|
||
"is_admin": true
|
||
}
|
||
}
|
||
|
||
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: 498
|
||
content-type: application/json; charset=utf-8
|
||
date: Tue,17 Feb 2026 20:22:57 GMT
|
||
vary: Origin
|
||
|
||
Responses
|
||
|
||
|
||
Register Backend
|
||
curl -X 'POST' \
|
||
'http://localhost:8080/api/v1/auth/register' \
|
||
-H 'accept: application/json' \
|
||
-H 'Content-Type: application/json' \
|
||
-d '{
|
||
"email": "ares@asdf.com",
|
||
"password": "12345678",
|
||
"username": "aresds"
|
||
}'
|
||
|
||
Request URL
|
||
|
||
http://localhost:8080/api/v1/auth/register
|
||
|
||
Server response
|
||
Code Details
|
||
201
|
||
Response body
|
||
Download
|
||
|
||
{
|
||
"message": "Registration successful. Please check your email to verify your account.",
|
||
"user": {
|
||
"id": 5,
|
||
"username": "aresds",
|
||
"email": "ares@asdf.com",
|
||
"email_verified": false,
|
||
"is_admin": false
|
||
}
|
||
}
|
||
|
||
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: 186
|
||
content-type: application/json; charset=utf-8
|
||
date: Tue,17 Feb 2026 20:24:12 GMT
|
||
vary: Origin
|
||
|
||
Email Token Dogrulama
|
||
|
||
curl -X 'GET' \
|
||
'http://localhost:8080/api/v1/auth/verify-email?token=e77abe8a0843b480cb00174d1a234568dea7ff8965c307365617f15726b20b00' \
|
||
-H 'accept: application/json'
|
||
|
||
Request URL
|
||
|
||
http://localhost:8080/api/v1/auth/verify-email?token=e77abe8a0843b480cb00174d1a234568dea7ff8965c307365617f15726b20b00
|
||
|
||
Server response
|
||
Code Details
|
||
200
|
||
Response body
|
||
Download
|
||
|
||
{
|
||
"message": "Email verified successfully"
|
||
}
|
||
|
||
Response headers
|
||
|
||
content-length: 41
|
||
content-type: application/json; charset=utf-8
|
||
date: Tue,17 Feb 2026 20:26:14 GMT
|
||
|
||
Refresh Token Backend
|
||
|
||
curl -X 'POST' \
|
||
'http://localhost:8080/api/v1/auth/refresh' \
|
||
-H 'accept: application/json' \
|
||
-H 'Content-Type: application/json' \
|
||
-d '{
|
||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzY1NDM3NzcsImlhdCI6MTc3MTM1OTc3Nywic3ViIjoyLCJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.1ASz8UcbuWY7zKRipoFuHbpTBcBMWEbp4TuNKlFffmA"
|
||
}'
|
||
|
||
Request URL
|
||
|
||
http://localhost:8080/api/v1/auth/refresh
|
||
|
||
Server response
|
||
Code Details
|
||
200
|
||
Response body
|
||
Download
|
||
|
||
{
|
||
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzEzNzExMjUsImlhdCI6MTc3MTM2MDMyNSwiaXNfYWRtaW4iOnRydWUsInN1YiI6MiwidG9rZW5fdHlwZSI6ImFjY2VzcyJ9.aW_xKEF2bWcC1xJdUTG4RB8T4ITH2ChnXNIqr8kAqXE",
|
||
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzY1NDQzMjUsImlhdCI6MTc3MTM2MDMyNSwic3ViIjoyLCJ0b2tlbl90eXBlIjoicmVmcmVzaCJ9.ybzA7oG7RJFSA5azD5h3mpwEXNapb2NyO4sWV-m3Jd4"
|
||
}
|
||
|
||
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: 396
|
||
content-type: application/json; charset=utf-8
|
||
date: Tue,17 Feb 2026 20:32:05 GMT
|
||
vary: Origin
|
||
############################
|
||
Auth ME
|
||
curl -X 'GET' \
|
||
'http://localhost:8080/api/v1/auth/me' \
|
||
-H 'accept: application/json' \
|
||
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NzEzNzIyMzIsImlhdCI6MTc3MTM2MTQzMiwiaXNfYWRtaW4iOnRydWUsInN1YiI6MiwidG9rZW5fdHlwZSI6ImFjY2VzcyJ9.LfpH9ldKqR2h1zqwXYHPNsqrzh20pYhFAdgCCEbKtwc'
|
||
|
||
Request URL
|
||
|
||
http://localhost:8080/api/v1/auth/me
|
||
|
||
Server response
|
||
Code Details
|
||
200
|
||
Response body
|
||
Download
|
||
|
||
{
|
||
"email": "beyhan@beyhan.dev",
|
||
"email_verified": true,
|
||
"id": 2,
|
||
"is_admin": true,
|
||
"username": "beyhan"
|
||
}
|
||
|
||
Response headers
|
||
|
||
content-length: 94
|
||
content-type: application/json; charset=utf-8
|
||
date: Tue,17 Feb 2026 20:51:52 GMT |