Experience API giving me '{ "error": "Authorization Required" }

I’m having problems with an API that uses an Experience endpoint method to trigger an experience workflow.

the endpoint is https://csi-cbm.onlosant.com and path to the endpoint is /api/custom-scripts/execute-scripts so I’m trying to post my payload data to https://csi-cbm.onlosant.com/api/custom-scripts/execute-scripts

The main part of the workflow is this:
if (!payload._working) {
payload._working = {};
}
let rows = ;
payload.data.body.scriptIds.forEach(sId => {
payload.data.body.assetIds.forEach(aId => {
rows.push({
scriptId: sId,
assetId: aId,
status: ‘NEW’,
scheduledTime: payload._working.scheduledTime,
timeToDeploy: payload.data.body.timeToExecute
});
});
});
payload._working.rows = rows;

From that, and debug output of a workflow that was triggered within the application, I’m providing this payload:

{
“data”: {
“body”: {
“deployWithProxy”: false,
“clearPartialCacheList”: true,
“assetIds”: [
“6182c2565a5de23fa275ebe2”
],
“scriptIds”: [
“620c17d514c9d8dd74316444”
]
}
}
}

and finally, the headers that go with my POST request.

‘accept’ => ‘application/json’
‘authorization’ => 'Bearer ’
‘cache-control’ => ‘no-cache’
‘content-type’ => ‘application/json’
‘host’ => ‘csi-cbm.onlosant.com
‘user-agent’ => ‘Mozilla/5.0’

So, the question is, why am I getting “Authorization Required” ?

First, this appears to be an application that you are working with Losant’s internal solutions team to build, so that group may be better suited to answer your question than me.

That said, the response suggests that either …

  • You are not providing a token with the “Authorization” header. Here, you said the value is just "Bearer "; I’m assuming you just removed the token since it is sensitive and this is a public forum? OR
  • The token you are providing is invalid …
    • It simply never was a valid Experience User token
    • The token was valid but it has expired
    • You are attempting to pass a token that authenticates against the Losant API and not your experience API