/oauth2/{dbname}/signin:
  get:
    tags:
      - auth
      - oauth2
    summary: Finishes an OAuth2 flow
    description: Finishes a 3rd party OAuth2 authentication flow. This is the url you have to add to your oAuth2 provider's allowed callback urls; the auth provider will redirect the login result to this address so AceBase auth can handle the signin and then redirect the user to the callbackUrl you provided in the oauth2 init endpoint.
    parameters:
      - name: dbname
        in: path
        description: name of the database
        required: true
        schema:
          type: string
          example: mydb
      - name: state
        in: query
        description: info about the initial oauth2 request (generated by AceBase)
        required: true
        schema:
          type: string
          example: sefwerg44tgwefvq3g4rbqewrgbqebwdfbwsergq34t...
      - name: code
        in: query
        required: false
        description: If signin is successful, contains the authorization code AceBase will use to request access and refresh tokens from the OAuth2 provider.
        schema:
          type: string
          example: erfuihqrf7g3rfgh3rifhwre8f73efuh3eifh...
      - name: error
        in: query
        description: If an error occurred, the error code
        required: false
        schema:
          type: string
          example: canceled
      - name: error_reason
        in: query
        description: If an error occurred, the error reason
        required: false
        schema:
          type: string
          example: user_canceled
      - name: error_description
        in: query
        description: If an error occurred, the error description
        required: false
        schema:
          type: string
          example: The user canceled the auth request
    responses:
      200:
        description: Redirects the user to the callbackUrl you provided in the init endpoint
        headers:
          Location:
            schema:
              type: string
              format: url
              example: https://my.website.com/oauth2/callback?result=er32f32g2erv2erv23g315g..
      500:
        description: If anything goes wrong on the server, it returns the actual error text in plain text
        content:
          'text/plain':
            schema:
              type: string
              example: Some error text