abhijit-ecsion / SmartEmail

Smart Dashboard with Emails Counts and View
0 stars 0 forks source link

AADSTS900144: The request body must contain the following parameter: 'grant_type' on Outlook Auth Token API #15

Open abhijit-ecsion opened 3 years ago

abhijit-ecsion commented 3 years ago

AADSTS900144: The request body must contain the following parameter: 'grant_type' on Outlook Auth Token API

Application Request

Request URL - https://login.microsoftonline.com/common/oauth2/v2.0/token? Application Request -

{"refresh_token":"MCVuZUcjuXgwiWty9IO5q2XKmknxD3aKx5FhTjhn*nRuP5*DxBLrsdIs9ED2HleY7tOqIPRglLR2rInQKoe8w*q9EZAvuFcbPwZAPvfO4jEzfuHtuAy57plKNo6bjMKtOnqgLPK*i6CfIq!OjY5oICcPKOJVIv3Va8IhiplQ0UbA1Hr1puk60kqBRVgegMgrDtD2gbOQel*q94uLh6jcgvX*iJDvbFIweY6rqlbfJ6sL2dLFTUOiXSr5poqi!6pNF3y2rcg!7ViQkegx05rG1y9cTIRs7!H6QhmuudW02W5JuDe7N1IgjeYn7!IsJaE*pZ!OmByyhvJZx7wyFJPFJwH9avn0oVmnsL8z!!roe54l6gw*20Juzp!hm7!KzOFzIdT36tnrZJGHRrdq9Q*DKl6e1sV0U3zy2kA9kTxhoD8KjqclaKXaccQ*g04N7aR2SENGi0WWzOcat9aezXyJTjWqxYlLKBmCiwKRb5MfwlWwRm9o9V93UlkEnXZOU69SBXXOjq30A9Max7zGru9Kk3eiZqpnZPIuqjoUDslyVNljXT43niT*ngpQ*lZjAoTpF5LOozbWQVL5BOc*UgaiT1d8cRhrx8woHeJJD*DrSEtw!Ce9daz0IYq*r0Do2FwpBdIj1LrHD4*S4PgDvbxojCs3la2LyP4m9FK3hS*oo5Xwd",
"client_id":"df35dfd4-65b5-4266-9d56-75b1481202c4",
"client_secret":"rVGERMS131=nhmiypB63}$)",
"client_secret":"https://salestracking2.ecsion.com/Settings/GetOutlookCode",
"grant_type":"refresh_token"}

Response Error –

{
    "error": "invalid_request",
    "error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: bb89c4b3-26ab-4388-8fee-cf1f73e91901\r\nCorrelation ID: 64295ffd-8f73-4e8b-bd35-03f59debe68f\r\nTimestamp: 2021-05-04 07:09:37Z",
    "error_codes": [
        900144
    ],
    "timestamp": "2021-05-04 07:09:37Z",
    "trace_id": "bb89c4b3-26ab-4388-8fee-cf1f73e91901",
    "correlation_id": "64295ffd-8f73-4e8b-bd35-03f59debe68f",
    "error_uri": "https://login.microsoftonline.com/error?code=900144"
}

Description - Error Invalid Grant Occurred on Access Token Request of registered outlook user, as the user account not granted due to the deprecation of Outlook API or it my be due to removal of access permission from user outlook account.

Solution Tried -

  1. Started again from Step 1 and request user consent if, for example you signed the user out, the Microsoft Account user changed their password, removed a device from their list of trusted devices, or removed permissions for your application to authenticate on their behalf.
  2. https://salesforce.stackexchange.com/questions/10759/invalid-grant-expired-access-refresh-token-error-when-authenticating-access-via
abhijit-ecsion commented 3 years ago

Outlook DEPRECATED the Use of Outlook REST API (version 2.0) instead of it we need to use services and features of Microsoft Graph.

Authentication and authorization basics for Microsoft Graph https://docs.microsoft.com/en-us/graph/auth/auth-concepts

Outlook mail API overview https://docs.microsoft.com/en-us/graph/outlook-mail-concept-overview