103 lines
2.2 KiB
YAML
103 lines
2.2 KiB
YAML
openapi: 3.0.0
|
|
info:
|
|
title: Auth Service API
|
|
version: 1.0.0
|
|
description: Authentication and Authorization Service API
|
|
|
|
servers:
|
|
- url: http://localhost/api/v1
|
|
description: Local development
|
|
- url: https://api.goodgo.vn/api/v1
|
|
description: Production
|
|
|
|
paths:
|
|
/auth/register:
|
|
post:
|
|
summary: Register new user
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
format: email
|
|
password:
|
|
type: string
|
|
minLength: 6
|
|
confirmPassword:
|
|
type: string
|
|
responses:
|
|
'201':
|
|
description: User registered successfully
|
|
'400':
|
|
description: Validation error
|
|
|
|
/auth/login:
|
|
post:
|
|
summary: Login user
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
email:
|
|
type: string
|
|
format: email
|
|
password:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Login successful
|
|
'401':
|
|
description: Invalid credentials
|
|
|
|
/auth/logout:
|
|
post:
|
|
summary: Logout user
|
|
security:
|
|
- bearerAuth: []
|
|
responses:
|
|
'200':
|
|
description: Logout successful
|
|
|
|
/auth/refresh:
|
|
post:
|
|
summary: Refresh access token
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
refreshToken:
|
|
type: string
|
|
responses:
|
|
'200':
|
|
description: Token refreshed
|
|
'401':
|
|
description: Invalid refresh token
|
|
|
|
/users/me:
|
|
get:
|
|
summary: Get current user
|
|
security:
|
|
- bearerAuth: []
|
|
responses:
|
|
'200':
|
|
description: User information
|
|
'401':
|
|
description: Unauthorized
|
|
|
|
components:
|
|
securitySchemes:
|
|
bearerAuth:
|
|
type: http
|
|
scheme: bearer
|
|
bearerFormat: JWT
|