Receiving [invalid_token_response] error while implementing OIDC (in Azure) for my SpringBoot Rest API

anwesha majumdar 0 Reputation points
2024-02-27T16:54:04.9266667+00:00

I am trying to secure my REST APIs suing OIDC (Azure IDP). I have used tenant id , client id, client secret etc. from registered app but receiving below error after login.But I am expecting to see teh page content/API response: "[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for "https://login.microsoftonline.com/6e93a626-8aca-4dc1-9191-ce291b4b75a1/oauth2/v2.0/token": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Navya 20,490 Reputation points Microsoft External Staff Moderator
    2024-02-28T08:36:52.4033333+00:00

    Hi @anwesha majumdar

    Thank you for posting this in Microsoft Q&A.

    I understand you are Receiving [invalid_token_response] error while implementing OIDC (in Azure) for my Spring Boot Rest API.

    Please follow the below steps to fix the issue:

    1.Verify that the Tenant ID, Application ID and Application_Secret entered in the application. properties accurate.

    2.Try with changing the azure endpoints from v2 to v1. This is done by changing the endpoints.

    http://login.microsoft.com/common/oauth2/v2.0/authorize becomes http://login.microsoft.com/common/oauth2/authorize

    If you are using Spring Boot version 2.5 or higher is required to complete the steps in this article.

    You can also refer to this post where similar issue has been discussed: https://stackoverflow.com/questions/70491599/invalid-token-response-an-error-occurred-while-attempting-to-retrieve-the-oauth

    Hope this helps. Do let us know if you any further queries.

    Thanks,

    Navya.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.