AADSTS7000215 error from Microsoft (Invalid client secret is provided)

Mozeli, Danilo 1 Reputation point
2021-11-18T15:08:12.297+00:00

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

Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,652 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,559 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mozeli, Danilo 1 Reputation point
    2021-11-19T17:24:40.71+00:00

    Hi,

    I'm following this document regarding "Authentication with OAuth" (https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth?view=bingads-13).

    The document says: "Microsoft Advertising leverages the Microsoft identity platform endpoint for developers and the OAuth 2.0 protocol to authenticate work or school accounts from Azure Active Directory (AAD)" - So I guess my app is using Azure AD to authenticate.

    My goal is to get an access token required to connect to make calls to the Bing Ads APIs in the backend application below:

    151082-image.png

    Thanks,

    Danilo

    0 comments No comments