---
agentTools:
  projectIndex: https://evolutionscript.readme.io/llms.txt
---

# Two-Factor Authentication

The Bearer token is the access token requested in [Request Access Token](https://evolutionscript.readme.io/reference/request-access-token) page.

Then token parameter is the access token received from [User Login](https://evolutionscript.readme.io/reference/user-login) page.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Api with Access Token",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://yoursite.com/api/"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/api/user_token/two_factor": {
      "post": {
        "summary": "Two-Factor Authentication",
        "description": "",
        "operationId": "two-factor-authentication",
        "parameters": [
          {
            "name": "Authentication",
            "in": "header",
            "description": "Ex: Bearer myAccessToken",
            "required": true,
            "schema": {
              "type": "string",
              "default": "Bearer {access_token}"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "two_factor",
                  "token"
                ],
                "properties": {
                  "two_factor": {
                    "type": "string",
                    "description": "The two-factor code of user."
                  },
                  "token": {
                    "type": "string",
                    "description": "The access token received from User Login request."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  status: 'success',\n  two_factor: false,\n  access_token: 'UserAccessToken...'\n}"
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n\tstatus: 'error',\n  message: 'invalid_two_factor'\n}"
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "65bd0d9a8cfebc004220b8d8:65bd65d089a3b50050452d61"
}
```