Device Code Authorization flow

To obtain Access tokens for authenticating to API v3 (/api/3/) APImetrics Endpoints, follow these steps:

1. Obtain a Device Code

  • Make a POST request to the /oauth/device/codeendpoint, providing your Client_id, Scope, and audience parameters as shown below.
    • URL: https://auth.apimetrics.io/oauth/device/code
    • Headers:
      • Content-Type : application/x-www-form-urlencoded
    • Body Parameters:
      • client_id : [string]
      • scope : [array]
      • audience: https://client.apimetrics.io
  • The Response will contain a Device code and a Verification URI Complete.

📘

Check with your organization Admin for your Organization's Client Id

2. Redirect the User

  • Direct the user to the verification_uri_complete link.

3. Obtain User's Consent

  • The user will be prompted to grant the application permission to access their data.

4. Exchange Device Code for Access Token

  • Make a POST request to /oauth/tokenendpoint, providing the Device code and Client Id parameters as shown below:
    • URL: https://auth.apimetrics.io/oauth/token
    • Headers:
      • Content-Type : application/x-www-form-urlencoded
    • Body Parameters:
      • grant_type : urn:ietf:params:oauth:grant-type:device_code
      • device_code : [string]
      • client_id : [string]
  • The Response contains an Access Token and an ID Token

👍

Once you have an Access Token, you can use it to authenticate your API v3 requests by including it in the Authorization header:

Authorization: Bearer <Access_Token>