I have a customer that provided these details for a API I need to use:
User_ID: "my_User_ID"
Client Secret: "my_client_secret"
Client_ID: "my_Client_ID",
Registered Oauth application name: Internal Careersite
Access Token Validity Period: 3600
Base adress: https://mySite-pilot.csod.com
Oauth scopes: Cornerstone API, jobrequisition:read - allows GET requests to following endpoints:
/services/api/Recruiting/JobRequisitionDetails
I read this guide for the API: https://apiexplorer.csod.com/apiconnectorweb/apiexplorer#/info
I then do a fetch to test my API (proxyUrl is a proxy for no-cors):
fetch(
proxyUrl +
"https://mySite-pilot.csod.com/services/api/Recruiting/JobRequisitionDetails",
{
headers: {
"clientId": "my_Client_ID",
"userId": "my_User_ID",
"clientSecret":"my_Client_Secret",
"Content-Type": "application/json",
"grantType": "client_credentials",
"scope": "jobrequisition:read",
'cache-control': 'no-cache',
Accept: "application/json",
method: "GET",
},
}
)
.then((response) =>console.log(response))
.then((data) => console.log(data));
Above fetch will return a 401 "authorization denied". I do believe that the way I authorize with my credentials is wrong, rather than the information I got. Is there anything wrong with the code?