Karthik Suresh
Karthik Suresh

Reputation: 1

{"ErrorCode":"invalid_request","Error":"Unsupported grant type : ","token_type":"Bearer"}

I am using the same setup I used in Postman, but I am getting an error in Azure data factory! Help me!

grant_type:client_credentials client_id:xxxxxxxxxxxxxxxxxxxx client_secret:xxxxxxxxxxxxxxxxx

The above, I tried inputting in the key value pairs in the body under x-www-form-urlencoded thats the only time it works, not with Bosy->raw->json nor raw->text

I tried the Json format but it doesnt work in both postman and ADF

{ "grant_type": "client_credentials", "client_id": "xxxxxxxxxxxxxxxxxxxxxx", "client_secret": "xxxxxxxxxxxxxxxxxxxx" }

grant_type=client_credentials&client_id=xxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxx

Both say the error is {"ErrorCode":"invalid_request","Error":"Unsupported grant type : ","token_type":"Bearer"}

But when I enter inputting in the key value pairs in the body -> x-www-form-urlencoded thats the only time it works, but when I use application/x-www-form-urlencoded and used the Key value edit to copy paste the format which was grant_type:client_credentials client_id:xxxxxxxxxxxxxxxxxxxx client_secret:xxxxxxxxxxxxxxxxx It still gives me same error in Azure data Factory but seems to work in postman

I tried content type as both text/plain, and application/x-www-form-urlencoded in headers

Upvotes: 0

Views: 1194

Answers (1)

Vamsi Bitra
Vamsi Bitra

Reputation: 2729

To resolve the error. Please follow the below steps:

Step1: Go to the active directory and check whether created AD application has enough API permission or not.

Step2: Create web activity to get bearer token from ADF.

URL : https://login.microsoftonline.com/<Tenant_Id>/oauth2/token

enter image description here

Method : POST

Note: Make sure to provide resource inside the body.

Body: grant_type=client_credentials&client_id=<client_id>&client_secret=<client_secret>&resource=https://graph.microsoft.com/

Header: Content-Type:application/x-www-form-urlencoded

enter image description here

For more information refer this SO thread.

Upvotes: 0

Related Questions