MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.14k stars 21.23k forks source link

error in grant type #43780

Closed nmachugari-winfo closed 4 years ago

nmachugari-winfo commented 4 years ago

Hi, While I am trying to get response from the post method. I am getting the following error

{"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: 8d24319a-7b99-4a9b-9134-e1e92fa52901\r\nCorrelation ID: f669e3e6-57ee-4725-baab-186cb844e7bd\r\nTimestamp: 2019-11-29 06:39:27Z","error_codes":[900144],"timestamp":"2019-11-29 06:39:27Z","trace_id":"8d24319a-7b99-4a9b-9134-e1e92fa52901","correlation_id":"f669e3e6-57ee-4725-baab-186cb844e7bd","error_uri":"https://login.microsoftonline.com/error?code=900144"}


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

shashishailaj commented 4 years ago

@Nalini-M Thank you for your query . We will investigate and update this thread further. Also We would like to request you to check out the new QnA forum that we have launched where you are welcome to ask troubleshooting related queries as well by tagging to specific products. We primarily use github for documentation related issues. So we would like to request you to use QnA forum in future. At this point we will try to answer this one here however it would be great if you could use the QnA forum for any queries/issues which are not related to documentation .

shashishailaj commented 4 years ago

@Nalini-M Thank you for your query. It seems that the The POST request does not contain correct Grant_type parameter value due to which you are getting the error. I am not really sure what request you are making however the grant_type denotes the type of oAuth authentication flow supported by Azure AD . I would suggest you to go through the linked articles and it will make things more clear for you.

Its value can be any of the following depending on type of Oauth Flow you are using within your application. I am listing out some of the flows Azure AD supports as below.

OAuth Flow types grant_type Value
Authorization Code Grant Flow grant_type=authorization_code
On Behalf of Flow grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
Client Credentials Flow grant_type=client_credentials
Device Code Flow grant_type=urn:ietf:params:oauth:grant-type:device_code
Resource Owner Password Credential Flow (ROPC) grant_type=password
SAML bearer Assertion Flow grant_type=urn:ietf:params:oauth:grant-type:saml1_1-bearer

Depending upon the flow your application supports , you will need to provide this value during the HTTP POST operation. I have linked every type of flow with related documentation which contain relevant examples as well. I would suggest you to go through the same and I am sure this will help you understand which oAuth flow you have followed within your application and what value for grant_type shall you use.

Hope the above helps. In case of any queries , please do let us know. In case there are no queries , I would suggest

Thank you.

nmachugari-winfo commented 4 years ago

In postman it's working when I use grant type as client credentials..In Uipath I am trying it ,then only I am getting error

Thanks and Regards, Nalini Devi Machugari.


From: ShashiShailaj-MSFT notifications@github.com Sent: Friday, November 29, 2019 9:16:53 PM To: MicrosoftDocs/azure-docs azure-docs@noreply.github.com Cc: Nalini Devi Machugari nalini.machugari@winfosolutions.com; Mention mention@noreply.github.com Subject: Re: [MicrosoftDocs/azure-docs] error in grant type (#43780)

@Nalini-Mhttps://github.com/Nalini-M Thank you for your query. It seems that the The POST request does not contain correct Grant_type parameter value due to which you are getting the error. I am not really sure what request you are making however the grant_type denotes the type of oAuth authentication flow supported by Azure ADhttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-app-types . I would suggest you to go through the linked articles and it will make things more clear for you.

Its value can be any of the following depending on type of Oauth Flow you are using within your application. I am listing out some of the flows Azure AD supports as below.

OAuth Flow types grant_type Value Authorization Code Grant Flow grant_type=authorization_codehttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-access-token On Behalf of Flow grant_type=urn:ietf:params:oauth:grant-type:jwt-bearerhttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#first-case-access-token-request-with-a-shared-secret Client Credentials Flow grant_type=client_credentialshttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow#first-case-access-token-request-with-a-shared-secret Device Code Flow grant_type=urn:ietf:params:oauth:grant-type:device_codehttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code#authenticating-the-user Resource Owner Password Credential Flow grant_type=passwordhttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc#authorization-request SAML bearer Assertion Flow grant_type=urn:ietf:params:oauth:grant-type:saml1_1-bearerhttps://docs.microsoft.com/en-us/azure/active-directory/develop/v2-saml-bearer-assertion#get-the-oauth2-token-using-the-saml-assertion

Depending upon the flow your application supports , you will need to provide this value during the HTTP POST operation. I have linked every type of flow with related documentation which contain relevant examples as well. I would suggest you to go through the same and I am sure this will help you understand which oAuth flow you have followed within your application and what value for grant_type shall you use.

Hope the above helps. In case of any queries , please do let us know. In case there are no queries , I would suggest

Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/MicrosoftDocs/azure-docs/issues/43780?email_source=notifications&email_token=AM6ASOX4VIFURWWBVRLLDTDQWE2O3A5CNFSM4JS3RMS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFPE3EQ#issuecomment-559828370, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM6ASOSA4TWPQQFC3HYUZO3QWE2O3ANCNFSM4JS3RMSQ.

shashishailaj commented 4 years ago

@Nalini-M Does UiPath support Client credential flow and do you see grant_type parameter being passed? Can you check their documentation ? In my experience I have not found many application which don't support client credential flow. But I am asking because in app-dev world the possibilities are endless and we can not always know how the application is designed. you would need to check what exact value is being passed by Uipath . Is there any HTTP debugger built in Uipath ? If yes you can use that to disssect the request body and see what all is passed on in the request. If the Uipath is not passing grant_type parameter value in request body then you would need to check it with Uipath support. Else I would suggest you to use fiddlercap to collect a Http trace on your machine where the request originates . The following is the step by step from the original fiddlercap page .

Step-by-step guide

You can download full version of fiddler using https://www.telerik.com/fiddler . Within the fiddler trace you should be able to see the details of the request body whether grant_type was passed or not. I checked with the correlationId and error provided in your comment earlier but on our end we did not receive any grant_type value and hence the error. As it is already working in postman , please let us know in case you find anything different which points to any errors on azure side and we will try to help you further. I am not sure but I believe some tweaking in Uipath config should do the trick .

shashishailaj commented 4 years ago

@Nalini-M I hope the information provided helped. As we have not received any further information from your side, we will proceed with closure on this thread. Should you have any further issue , feel free to tag me or the author of this document to your reply and we will be happy to help you .