Popsink auth API

The auth API from Popsink — 8 operation(s) for auth.

OpenAPI Specification

popsink-auth-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Fast admin auth API
  version: 0.1.0
servers:
- url: /api
tags:
- name: auth
paths:
  /auth/jwt/login:
    post:
      tags:
      - auth
      summary: Auth:Jwt.Login
      operationId: auth_jwt_login_auth_jwt_login_post
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/Body_auth_jwt_login_auth_jwt_login_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BearerResponse'
              example:
                access_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiOTIyMWZmYzktNjQwZi00MzcyLTg2ZDMtY2U2NDJjYmE1NjAzIiwiYXVkIjoiZmFzdGFwaS11c2VyczphdXRoIiwiZXhwIjoxNTcxNTA0MTkzfQ.M10bjOe45I5Ncu_uXvOmVV8QxnL-nZfcH96U90JaocI
                token_type: bearer
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
              examples:
                LOGIN_BAD_CREDENTIALS:
                  summary: Bad credentials or the user is inactive.
                  value:
                    detail: LOGIN_BAD_CREDENTIALS
                LOGIN_USER_NOT_VERIFIED:
                  summary: The user is not verified.
                  value:
                    detail: LOGIN_USER_NOT_VERIFIED
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/jwt/logout:
    post:
      tags:
      - auth
      summary: Auth:Jwt.Logout
      operationId: auth_jwt_logout_auth_jwt_logout_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '401':
          description: Missing token or inactive user.
      security:
      - OAuth2PasswordBearer: []
  /auth/register:
    post:
      tags:
      - auth
      summary: Register:Register
      operationId: register_register_auth_register_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserCreate'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
              examples:
                REGISTER_USER_ALREADY_EXISTS:
                  summary: A user with this email already exists.
                  value:
                    detail: REGISTER_USER_ALREADY_EXISTS
                REGISTER_INVALID_PASSWORD:
                  summary: Password validation failed.
                  value:
                    detail:
                      code: REGISTER_INVALID_PASSWORD
                      reason: Password should beat least 3 characters
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/forgot-password:
    post:
      tags:
      - auth
      summary: Reset:Forgot Password
      operationId: reset_forgot_password_auth_forgot_password_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_reset_forgot_password_auth_forgot_password_post'
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/reset-password:
    post:
      tags:
      - auth
      summary: Reset:Reset Password
      operationId: reset_reset_password_auth_reset_password_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_reset_reset_password_auth_reset_password_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
              examples:
                RESET_PASSWORD_BAD_TOKEN:
                  summary: Bad or expired token.
                  value:
                    detail: RESET_PASSWORD_BAD_TOKEN
                RESET_PASSWORD_INVALID_PASSWORD:
                  summary: Password validation failed.
                  value:
                    detail:
                      code: RESET_PASSWORD_INVALID_PASSWORD
                      reason: Password should be at least 3 characters
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/request-verify-token:
    post:
      tags:
      - auth
      summary: Verify:Request-Token
      operationId: verify_request_token_auth_request_verify_token_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_verify_request_token_auth_request_verify_token_post'
        required: true
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/verify:
    post:
      tags:
      - auth
      summary: Verify:Verify
      operationId: verify_verify_auth_verify_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_verify_verify_auth_verify_post'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserRead'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
              examples:
                VERIFY_USER_BAD_TOKEN:
                  summary: Bad token, not existing user ornot the e-mail currently set for the user.
                  value:
                    detail: VERIFY_USER_BAD_TOKEN
                VERIFY_USER_ALREADY_VERIFIED:
                  summary: The user is already verified.
                  value:
                    detail: VERIFY_USER_ALREADY_VERIFIED
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /auth/:
    post:
      summary: Auth
      description: "Authenticate the user from Auth0.\n\nAuth0 response is like:\n{\n    \"access_token\": \"eyJ...Ggg\",\n    \"expires_in\": 86400,\n    \"scope\": \"read:clients create:clients read:client_keys\",\n    \"token_type\": \"Bearer\"\n}"
      operationId: auth_auth__post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Credentials'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      tags:
      - auth
components:
  schemas:
    UserRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        email:
          type: string
          format: email
          title: Email
        is_active:
          type: boolean
          title: Is Active
          default: true
        is_superuser:
          type: boolean
          title: Is Superuser
          default: false
        is_verified:
          type: boolean
          title: Is Verified
          default: false
        active_env_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Active Env Id
      type: object
      required:
      - id
      - email
      - active_env_id
      title: UserRead
      description: Read a user.
    Body_auth_jwt_login_auth_jwt_login_post:
      properties:
        grant_type:
          anyOf:
          - type: string
            pattern: ^password$
          - type: 'null'
          title: Grant Type
        username:
          type: string
          title: Username
        password:
          type: string
          title: Password
        scope:
          type: string
          title: Scope
          default: ''
        client_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Client Id
        client_secret:
          anyOf:
          - type: string
          - type: 'null'
          title: Client Secret
      type: object
      required:
      - username
      - password
      title: Body_auth_jwt_login_auth_jwt_login_post
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    Body_reset_forgot_password_auth_forgot_password_post:
      properties:
        email:
          type: string
          format: email
          title: Email
      type: object
      required:
      - email
      title: Body_reset_forgot_password_auth_forgot_password_post
    BearerResponse:
      properties:
        access_token:
          type: string
          title: Access Token
        token_type:
          type: string
          title: Token Type
      type: object
      required:
      - access_token
      - token_type
      title: BearerResponse
    Credentials:
      title: Credentials
      required:
      - username
      - password
      type: object
      properties:
        username:
          title: Username
          type: string
        password:
          title: Password
          type: string
      description: Define a message event, to send to kafka.
    Body_verify_verify_auth_verify_post:
      properties:
        token:
          type: string
          title: Token
      type: object
      required:
      - token
      title: Body_verify_verify_auth_verify_post
    Body_verify_request_token_auth_request_verify_token_post:
      properties:
        email:
          type: string
          format: email
          title: Email
      type: object
      required:
      - email
      title: Body_verify_request_token_auth_request_verify_token_post
    UserCreate:
      properties:
        email:
          type: string
          format: email
          title: Email
        password:
          type: string
          title: Password
        is_active:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Active
          default: true
        is_superuser:
          type: boolean
          title: Is Superuser
          default: false
        is_verified:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Verified
          default: false
      type: object
      required:
      - email
      - password
      title: UserCreate
      description: Create a user.
    Body_reset_reset_password_auth_reset_password_post:
      properties:
        token:
          type: string
          title: Token
        password:
          type: string
          title: Password
      type: object
      required:
      - token
      - password
      title: Body_reset_reset_password_auth_reset_password_post
    ErrorModel:
      properties:
        detail:
          anyOf:
          - type: string
          - additionalProperties:
              type: string
            type: object
          title: Detail
      type: object
      required:
      - detail
      title: ErrorModel
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: auth/jwt/login