Get messgae error "401 Unauthorized" after use ISC API in workflow

:bangbang: Please be sure you’ve read the docs and API specs before asking for help. Also, please be sure you’ve searched the forum for your answer before you create a new topic.

I launch external trigger workflow and get error at HTTP Request step,the whole error message is “task failed: activity error (type: sp:external:http:v2, scheduledEventID: 29, startedEventID: 30, identity: 1@sp-workflow-worker-stg-ap-southeast-2-6fc959f99b-slb7q@sp-workflow-engine): request failed (type: HTTP Response Returned a Client Error, retryable: false): request failed: 401 - 401 Unauthorized - {“error”:“invalid_client”,“error_description”:“Bad client credentials”}“.At Http Request step,I call Account List API,filter is IdenitityId and the results sort by source.displayableName.

I think the problem is not user right because I use the same client_Id and client_sceret to call Account List API by powershell and status code is 200.what reason cause this problem?

workflowExecution20260119.json (10.8 KB)

externalTriggerWorkflow.json (16.4 KB)

Hi @TOPTYU

Can you please attach screenshots

you mean workflow in ISC screen shot?

Hello @TOPTYU, I suspect the issue with the request URL Can you try updating the values in the URL directly and check if that’s working?

image

something like this
https://-sb.api.identitynow.com/v2025/accounts?sorters=source.displayableName&filters=identityId eq cf076f5582254ee8a43bf70dcf9eeeba

I doubt URL is not getting escaped properly

image

Hey @TOPTYU

I verified your Workflow File, It looks good to me. Can you please check your client id and secret and if they have valid permission or not.

Or Try creating a new clientID and clientSecret with required permissions and use that details in your workflow.

Thanks

Hi @TOPTYU,

Hope you’re doing great!

Your workflow looks very unusual to me:

  1. Why are you building the URL using defineVariable operators? If you type the values directly in the httpRequest action, do you still see the same error?

  2. You don’t need to include %20eq%20%22 in the request URL. Just write the full URL — the workflow engine will handle encoding automatically.

  3. Is there any reason you’re passing the secret as a Request Header? If you remove that and put the secret in the Client Secret field instead, does the error persist?

  4. Your credentials are probably correct, but the way the URLs and the credentials are being passed seems off. Please review all the HttpRequest steps carefully.

Hope this helps you move closer to the solution!

I have changed direct url but I get the same error message after execution.

workflowExecution20260120 (12).json (10.6 KB)

First,I use the same client_id and client_secret to call API by powershell and I can get the data successfully.Second,the client_id and client_secret I use is created yesterday.

1.I try to use direct url but I get the same error.

2.I change %20eq%20%22 to eq “ but execute fail.

workflowExecution20260120 (13).json (10.5 KB)

3.no reason,just try and error.I have remove client_secret in requset header but error still occurred.

I would suggest deleting “HTTP request” step and recreate it by entering creds again and test it

I recreate the Http step and get the same error message again

Can you try changing below setting to “Body“ in HTTP Request step and try it once? I see you are passing the creds in header

Hi @TOPTYU,

Instead of defining filters and sorters directly in the URL, could you try adding them separately using the ‘Request URL Parameters’ option provided in the HTTP request action and then test it again?

Given that you mentioned the same API executes successfully with the same credentials via PowerShell.

@TOPTYU Make sure PAT you are using have right user level access like ORG_ADMIN,SOURCE_ADMIN

Check API specification

If permissions are in place then try to add below Request URL parameter like below and test it should work

1 Like

I put the credential in body but the error still occcurred.

workflowExecution20260121.json (10.4 KB)

I use Request URL Parameter but the error still occurred

workflowExecution20260121 (5).json (10.7 KB)

I call the same api successfully in my partner environment.So,I confuse that if the problem is right of PAT,why I call accountList API successfully by powershell.

1.I reference the doc you provide and change my user level to Admin, Source Admin, HelpDesk.I found ORG_ADMIN not exist in ISC and the user cann’t have source admin and source sub admin the same time
2.I use Request URL Parameter in Http Request Action
Unfortunately,I launch the workflow again the same error still occurred.

my user level:

my PAT setting:

myPATSetting.json (446 Bytes)

workflowExecution:

workflowExecution20260121 (7).json (10.7 KB)

ISCAPICALL20260120.json (1.2 KB)

start with basic and build each step as you need to make sure you are not lost in the shuffle. the attached is very very basic stuff which is working for me and see if this works else its easy to troubleshoot if its your creds or something else.

I create another workflow and reference your workflow setting.But the error still occurred after execution.

workflow script:

callAccountListAPI.json (1.4 KB)

workflowExecution:

workflowExecution20260121 (4).json (2.4 KB)

Hi @TOPTYU,

As you mentioned that the identity you’re using has been granted admin privileges, could you try generating new PAT credentials and then call the API using those new credentials?

Also, could you try using the v3 version of the APIs once and check if that works?