Home > Blockchain >  How to pass bearer token API in Azure Data Factory
How to pass bearer token API in Azure Data Factory

Time:09-20

I have an API which has Authorization has bearer token. I tested in post man and it's working. However, it's not working when I used web activity in the ADF.

enter image description here

I am passing the url in the URL section. Created new header, typed Authorization and gave value "Bearer token"

Getting below error

Error
Troubleshoot activity failures
{
    "errorCode": "2108",
    "message": "{\"error\":{\"type\":\"invalid_request_error\",\"message\":\"Request forbidden by administrative rules. Please make sure your request has an acceptable User-Agent header.\",\"documentation_url\":\"https://developer.dentally.co\"}}",
    "failureType": "UserError",
    "target": "Web1",
    "details": []
}


Can anyone please advise?

CodePudding user response:

I reproduced the same in my environment. I successfully generated a bearer Token with Postman.

To solve the above error code:2200. Please follow the below approach.

enter image description here

  • I used the same URL with web Activity and generated a bearer Token in the Azure data factory. enter image description here

  • Generate bearer Token as shown below:

enter image description here

  • Connect Web activity 2 with newly created Web1 activity

enter image description here

  • Add dynamic expression : Bearer @{activity('Web2').output.data.Token}

enter image description here

Output:

enter image description here

Reference:

Sample Rest API URL for testing with authentication by Ashok Patel

  • Related