I'm trying to obtain token on:
login.microsoftonline.com/common/oauth2/v2.0/token
I'm receive the error:
AADSTS7000215: Invalid client secret is provided
I am sure that client_secret is correct and not expired. Also, I encoded the client_secret to make sure special characters are properly passed.
What can be the reason for such error?
Request body:
POST /common/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id=<masked>
&scope=https%3A%2F%2Fads.microsoft.com%2Fmsads.manage
&code=<masked>
&redirect_uri=http://localhost/myapp/
&grant_type=authorization_code
&client_secret=<masked>
Error:
{
"error": "invalid_client",
"error_description": "AADSTS7000215: Invalid client secret is provided.\r\nTrace ID: 0665187b-dcc8-4f74-a6c3-6f47d3462601\r\nCorrelation ID: d4c3529a-2e76-4f5a-949f-3b26ff6863bd\r\nTimestamp: 2021-11-18 15:01:29Z",
"error_codes": [
7000215
],
"timestamp": "2021-11-18 15:01:29Z",
"trace_id": "0665187b-dcc8-4f74-a6c3-6f47d3462601",
"correlation_id": "d4c3529a-2e76-4f5a-949f-3b26ff6863bd",
"error_uri": "https://login.microsoftonline.com/error?code=7000215"
}
Thanks