Retrieve an Auth Token
Overview
Retrieve an access token that you can use when you make a request to a protected endpoint.
URL
POST /authToken
Request
You should have received your clientID and clientSecret from MetaMetrics when MetaMetrics set up your account.
Parameter | Format | Description |
---|---|---|
clientID |
String | The identifier you use to connect to MetaMetrics' API. |
clientSecret |
String | The shared secret associated with your clientId that
is used to authenticate your account. |
Response
Code | Description | Example |
---|---|---|
200 | The call was successful. |
|
401 | We weren't able to authenticate your credentials. The access token is incorrect or missing |
|
403 | You can't perform this action. doesn't have access to this feature. |
|
Code Examples
This Python example is written for use with Python 3 and above.
import requests client_id = "abcdefg" # replace with your provided client ID client_secret = "hijklmnopqrstuvwxyz" # replace with your provided client secret response = requests.post( "https://[apiendpoint]/authToken", # replace with the endpoint for the api you're working with json={"clientId": client_id, "clientSecret": client_secret} ) access_token = response.json()['accessToken'] # use in Authorization header