Search code examples
oauth-2.0azure-active-directoryauthorization

Microsoft identity platform and OAuth 2.0 authorization code flow (PKCE) - Error "AADSTS700025"


Trying to get access token by following the microsoft instructions.But I get an error, for that there is no answer with a solution. What am I doing wrong, what this mean in my situation? enter image description here Requests: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize *auth_code : client_id & response_type & redirect_uri & response_mode & scope & code_challenge & code_challenge_method.

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token *get access token: client_id & scope & code & redirect_uri & grant_type & code_verifier & client_secret.(Content-Type: application/x-www-form-urlencoded) redirect_uri == are the same in both cases.

In the first request it is possible to get auth_code, but when i trying to get access token with this auth_code then I get : Error "AADSTS700025" Client is public so neither 'client_assertion' nor 'client_secret' should be presented. But I use client_secret NOT client_assertion_type & client_assertion. Followed the microsoft instructions...


Solution

  • Reproduce the same kind of issue as you are facing (As i am using AuthCode to generate Access Token)

    enter image description here

    Solution--

    Aussming you are using grant_type is client_credentials to get the access token using below API:

    https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token
    

    To get the access token you don't require the AuthCode you can get it by client credentails only. Please do the configuration as i did below picture in my Body.

    enter image description here

    enter image description here