Skip to main content

Get an access token

The GraphQL API uses OAuth 2.0 to authorize applications. Applications must request an access token using the Client Credentials flow using the Client ID and Client Secret for your API key (see Creating an API key).

Requests an access token

To request an access token send a POST request as follows (line breaks have been added between parameters to make them easier to read):

POST /dff76352-1ded-46e8-96a4-1a83718b2d3a/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com:443
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&scope=https%3A%2F%2Feventsairprod.onmicrosoft.com%2F85d8f626-4e3d-4357-89c6-327d4e6d3d93%2F.default
&client_id={{YOUR_CLIENT_ID}}
&client_secret={{YOUR_CLIENT_SECRET}}

The following table describes the parameters required when requesting an access token:

ParameterValue
grant_typeMust be set to client_credentials
scopeMust be set to https://eventsairprod.onmicrosoft.com/85d8f626-4e3d-4357-89c6-327d4e6d3d93/.default
client_idMust be set to the value of the Client ID issued to you for your application
client_secretMust be set to the value of the Client Secret issued to you for your application
tip

For development and testing, Postman makes it easy to configure these settings and generate an authorization token. See Authorizing requests in the Postman documentation.

Access token lifetime

The access token is valid for 60 minutes. You will need to retrieve a new authentication token following the above steps if your token has expired.