openapi: 3.0.1
info:
  title: Auth Api Documentation
  description: Auth Api Documentation
  version: '1.10'
servers:
  - url: https://dev.rarible.com
  - url: https://rinkeby.rarible.com
  - url: https://testnet.rarible.com
  - url: https://rarible.com
paths:
  '/marketplace/auth/v1/auth/wallet':
    post:
      tags:
        - auth-controller
      summary: Authenticate using ethereum wallet
      operationId: authWithWalletUsingPOST
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletAuthForm'
      responses:
        '200':
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
                description: RSESSIONID - JWT token with session. XSRF-TOKEN - csrf token

  '/marketplace/auth/v1/auth/token':
    get:
      tags:
        - auth-controller
      summary: Get One Time Token
      operationId: getOneTimeTokenUsingGET
      security:
        - cookieAuth: [ ]
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: string
                description: one time token
  '/marketplace/auth/v1/auth/logout':
    get:
      tags:
        - auth-controller
      summary: logout
      operationId: logoutUsingGET
      responses:
        '200':
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
                description: removes XSRF-TOKEN and RSESSIONID
  '/marketplace/auth/v1/auth/check':
    get:
      tags:
        - auth-controller
      summary: Check authentication and get csrf token
      operationId: checkUsingGET
      security:
        - cookieAuth: [ ]
      responses:
        '200':
          description: OK
          headers:
            Set-Cookie:
              schema:
                type: string
                description: XSRF-TOKEN - csrf token
  '/marketplace/auth/v1/date':
    get:
      tags:
        - date-controller
      summary: Get current server date
      operationId: currentDateUsingGET
      responses:
        '200':
          description: OK
          content:
            'application/json':
              schema:
                $ref: '#/components/schemas/DateResponse'

components:

  securitySchemes:

    cookieAuth:
      type: apiKey
      in: cookie
      name: RSESSIONID

  schemas:

    WalletAuthForm:
      title: WalletAuthForm
      description: 'message format must be - "I want to login on Rarible at $date. I accept the Rarible Terms of Service https://static.rarible.com/terms.pdf and I am at least 13 years old." Ex: I want to login on Rarible at 2021-09-17T05:01:18.939Z. I accept the Rarible Terms of Service https://static.rarible.com/terms.pdf and I am at least 13 years old.'
      type: object
      required:
        - date
        - signature
        - signer
      properties:
        date:
          type: string
          format: date-time
          description: 'ISO 8601, Ex: 2021-09-17T04:52:42.462Z'
        signature:
          type: string
        signer:
          type: string
          format: address
        publicKey:
          type: string
    DateResponse:
      title: DateResponse
      description: Current server date to use for signature
      type: object
      required:
        - date
      properties:
        date:
          type: string
          format: date-time
          description: 'ISO 8601, Ex: 2021-09-17T04:52:42.462Z'
