I am using Post method try to get the access token thru Oauth 2.
URI:https://apiv2.webdamdb.com/oauth2/token.php
Body :
grant_types=@{variables('grant_type')}&client_id=@{variables('client_id')}&client_secret=@{variables('client_secret')}&username=@{variables('username')}&password=@{variables('pw')}
and got the error messsage below
{
"error": "invalid_request",
"error_description": "The grant type was not specified in the request"
}
any suggestion ? Thanks
Note: i was able to run this in Postman without any issue
Hello,
I got the same problem. After hours and hours of headache: the body must be JSON formated...
From
Body :
grant_types=@{variables('grant_type')}&client_id=@{variables('client_id')}&client_secret=@{variables('client_secret')}&username=@{variables('username')}&password=@{variables('pw')}
To
{ "grant_types":@{variables('grant_type')}, "client_id":@{variables('client_id')}, "client_secret":@{variables('client_secret')}, "username":@{variables('username')}, "password":@{variables('pw')} }
Maybe you will have to add double quotes arround your values, but anyway, this is the solution.
Regards!
hi @v-yamao-msft , thanks for your response
the grant_type=password that is how i define in here. i tried to put grant_type in headers, body ,... it still the same error message. In Postman, it put grant_type=password in body. it works fine. i did establish the other connection using Oauth 2 with grant_type=client_credentials in FLOW; it works completely fine. Not sure why i keep getting the error message. any suggesstion ? Thanks
Hi @vnguyen1 ,
The error message says that the grant type was not specified in the request.
From the info you provided, a variable is used for the grant_type. How is the variable configured?
From the following doc we know that, to request an access token, the grant_type should be authorization_code for the authorization code flow.
Please make sure you have specified the grant type properly.
Here is the link of the doc:
https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
Best regards,
Mabel
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional