> ## Documentation Index
> Fetch the complete documentation index at: https://docs.near.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Complete a sign-in

> The address the sign-in provider sends the browser back to. It is not called directly: GitHub or Google adds the `code` and `state` parameters. A successful sign-in answers with the access token and refresh token as JSON. Send a `User-Agent` header.



## OpenAPI

````yaml /api-reference/cloud-platform-openapi.json get /v1/auth/callback
openapi: 3.1.0
info:
  description: Account, organization, workspace and billing routes of NEAR AI Cloud.
  title: NEAR AI Cloud Platform API
  version: '5'
servers:
  - url: https://cloud-platform.near.ai
    description: NEAR AI Cloud Platform
security: []
paths:
  /v1/auth/callback:
    get:
      tags:
        - Authentication
      summary: Complete a sign-in
      description: >-
        The address the sign-in provider sends the browser back to. It is not
        called directly: GitHub or Google adds the `code` and `state`
        parameters. A successful sign-in answers with the access token and
        refresh token as JSON. Send a `User-Agent` header.
      operationId: complete_sign_in
      parameters:
        - description: The authorization code from the provider.
          in: query
          name: code
          required: false
          schema:
            type: string
        - description: The state value from the provider.
          in: query
          name: state
          required: true
          schema:
            type: string
        - description: Set by the provider when the user did not approve the sign-in.
          in: query
          name: error
          required: false
          schema:
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenExchangeResponse'
          description: Signed in.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
          description: >-
            The sign-in could not be completed, for example because the state is
            invalid or expired or the user did not approve it.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
          description: The provider did not authenticate the user.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
          description: Sign-in is not available for this account.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
          description: The sign-in conflicts with an existing account.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OAuthErrorResponse'
          description: Internal error.
components:
  schemas:
    TokenExchangeResponse:
      description: The tokens of a completed sign-in and the account they belong to.
      properties:
        access_token:
          description: 'Access token, sent as `Authorization: Bearer <token>`.'
          type: string
        refresh_token:
          description: >-
            Refresh token beginning with `rt_`. Exchange it for a new access
            token before the access token expires.
          type: string
        refresh_token_expiration:
          description: When the refresh token expires.
          format: date-time
          type: string
        user:
          $ref: '#/components/schemas/AuthResponse'
      required:
        - access_token
        - refresh_token
        - refresh_token_expiration
        - user
      type: object
    OAuthErrorResponse:
      description: The error body of the sign-in routes.
      properties:
        error:
          description: A short error code, such as `invalid_request` or `access_denied`.
          type: string
        error_description:
          description: A human-readable description of the error.
          type: string
      required:
        - error
        - error_description
      type: object
    AuthResponse:
      description: The signed-in account, as a sign-in answers it.
      properties:
        email:
          description: The email address the account signs in with.
          type: string
        message:
          type: string
        provider:
          description: 'The sign-in provider: `github`, `google` or `near`.'
          type: string
      required:
        - message
        - email
        - provider
      type: object

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.