Announcements

Help us improve the Equinix Community by completing a quick survey

Discussions

Fabric API generate token using client_credentials

Fabric API generate token using client_credentials

API_User
Level 9

I am trying to generate token using this method but in Postman:

Access Token using grant_type = client_credentials (Recommended).

POST 'https://api.equinix.com/oauth2/v1/token' -H "content-type: application/json" -d '{ "grant_type": "client_credentials", "client_id": "******", "client_secret": "****" }'

I have the body set as specified in the link: https://developer.equinix.com/docs?page=/dev-docs/fabric/overview but when I execute the query I get this error:

{
    "errorDomain": "apps-fqa",
    "errorTitle": "Unable to Process the Request",
    "errorCode": "S1002",
    "developerMessage": "Failed to execute the ExtractVariables: extractjsonparams",
    "errorMessage": "Unable to Process the Request, Please try again later."
}

I have a client_id and client_sercret generated and have tested it with Terraform. What am I missing?

Thanks!

Replies 3 3

API_User
Level 9

I have this problem also.


The oauth2/v1 API worked since year ago, but there are many updates on the API.

https://developer.equinix.com/catalog/fabricv4 shows only bearer auth without any example on how to get a bearer token.

API_User
Level 9

Got it, used wrong credentials

 

access_token=`curl -s --request POST \ 
--url https://${endpoint_url}/oauth2/v1/token \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"client_id":"'${client_id}'","client_secret":"'${client_secret}'","grant_type":"client_credentials"}' \
| jq -r '.access_token'`

 

API_User
Level 9
Nice, glad you got this one. Should have replied when I was able to get it working in Postman, few hours later posting this message 🙂 .
Used raw rather than json as it is normally in a cli.