# Get access token

Retrieve an OAuth 2.0 access token based on a given client ID, and client secret. The access token has an expiration time of 10 minutes hour.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Authentication",
    "version": "4.0.10"
  },
  "servers": [
    {
      "url": "https://login.microsoftonline.com/",
      "description": "Microsoft Azure's B2C login server"
    }
  ],
  "tags": [
    {
      "name": "Authentication",
      "description": "Allows the retrieval of an OAuth 2.0 token required to access the Context Store API, the Reporting API, and the APM API."
    }
  ],
  "paths": {
    "/digitalcx.onmicrosoft.com/oauth2/token": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Get access token",
        "description": "Retrieve an OAuth 2.0 access token based on a given client ID, and client secret. The access token has an expiration time of 10 minutes hour.",
        "requestBody": {
          "content": {
            "application/x-www-form-urlencoded": {
              "schema": {
                "type": "object",
                "required": [
                  "client_id",
                  "client_secret"
                ],
                "properties": {
                  "client_id": {
                    "type": "string",
                    "description": "The unique client ID"
                  },
                  "client_secret": {
                    "type": "string",
                    "description": "The unique client secret"
                  },
                  "grant_type": {
                    "type": "string",
                    "description": "The OAuth 2.0 flow used to generate the token",
                    "enum": [
                      "client_credentials"
                    ]
                  },
                  "resource": {
                    "type": "string",
                    "description": "The resource that determines the access scope of the generated token",
                    "enum": [
                      "https://digitalcx.onmicrosoft.com/external-api"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginSchema"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LoginSchema": {
        "type": "object",
        "description": "Response object for an authentication request.",
        "properties": {
          "token_type": {
            "type": "string",
            "example": "Bearer"
          },
          "expires_in": {
            "type": "string",
            "example": "3600"
          },
          "ext_expires_in": {
            "type": "string",
            "example": "0"
          },
          "expires_on": {
            "type": "string",
            "example": "0000000000"
          },
          "not_before": {
            "type": "string",
            "example": "0000000000"
          },
          "resource": {
            "type": "string",
            "description": "",
            "example": "https://digitalcx.onmicrosoft.com/external-api"
          },
          "access_token": {
            "type": "string",
            "description": "The access token that's used to access the Context Store, Reporting API, and APM API's.",
            "example": "XXXX.XXXXXXXX.XXXX"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 102,
      "1": 39,
      "2": 158,
      "3": 86,
      "4": 220,
      "5": 93,
      "6": 125,
      "7": 0,
      "8": 17,
      "9": 183,
      "10": 243,
      "11": 158
    }
  }
}
```