Skip to content

Commit

Permalink
#54 Design taufik HTTP API
Browse files Browse the repository at this point in the history
  • Loading branch information
vityaman committed Nov 12, 2024
1 parent 53248fa commit f8e61f3
Showing 1 changed file with 107 additions and 0 deletions.
107 changes: 107 additions & 0 deletions backend/authik/src/main/resources/static/openapi/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,115 @@ paths:
$ref: "#/components/responses/503"
default:
$ref: "#/components/responses/Unexpected"
/auth/telegram/web-app:
put:
tags: [Telegram]
summary: Authenticate via Telegram
description: |
Takes data received via the Telegram Mini App,
validates and returns JWT access token
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/TelegramWebAppInitData"
responses:
"200":
description: Data is valid, identity verified
content:
application/json:
schema:
$ref: "#/components/schemas/AuthGrant"
"400":
$ref: "#/components/responses/400"
"403":
description: User is banned
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
"503":
description: Telegram is unavailable
content:
application/json:
schema:
$ref: "#/components/schemas/GeneralError"
default:
$ref: "#/components/responses/Unexpected"
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: Supports RFC8725
schemas:
TelegramWebAppInitData:
description: https://core.telegram.org/bots/webapps#webappinitdata
type: object
properties:
query_id:
type: string
user:
$ref: "#/components/schemas/TelegramWebAppUser"
auth_date:
type: integer
format: int64
minimum: 1577826000
hash:
type: string
pattern: ^[A-Fa-f0-9]{64}$
maxLength: 64
required:
- user
- auth_date
- hash
TelegramWebAppUser:
description: https://core.telegram.org/bots/webapps#webappuser
type: object
properties:
id:
type: integer
format: int64
minimum: 0
first_name:
type: string
maxLength: 128
minLength: 1
last_name:
type: string
maxLength: 128
minLength: 1
username:
type: string
maxLength: 128
minLength: 1
required:
- id
- first_name
AccessToken:
description: A JWT token required to access resources
type: string
pattern: ^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.[A-Za-z0-9-_.+=]*$
maxLength: 1024
UserId:
description: ITMO Dating User Identity number
type: integer
minimum: 0
maximum: 150000000
AuthGrant:
description: Access token
type: object
properties:
userId:
$ref: '#/components/schemas/UserId'
access:
$ref: '#/components/schemas/AccessToken'
required:
- userId
- access
GeneralError:
type: object
properties:
Expand Down

0 comments on commit f8e61f3

Please sign in to comment.