I need to validate the auth token, from azure ad

Rafael Massinatore 21 Reputation points
2022-07-12T17:23:05.887+00:00

Hi, I am authenticating the user of my SPA application, I followed:
https://learn.microsoft.com/en-us/azure/active-directory/develop/single-page-app-quickstart?pivots=devlang-angular

I received the token, but I would like to verify in java, if this token is the right one, but I am not finding how I can do this, any help on how I can verify the backend with this token

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
18,552 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Cristian SPIRIDON 4,471 Reputation points
    2022-07-12T20:18:58.73+00:00

    Hi,

    Below post explain how to validate JWT issued by Azure AD in java script:

    https://www.voitanos.io/blog/validating-azure-ad-generated-oauth-tokens/

    You have to pay attention to the aud claim and properly check the signature.

    Hope this helps!

    1 person found this answer helpful.
    0 comments No comments

  2. Alfredo Revilla (MSFT) 26,816 Reputation points
    2022-07-31T03:26:40.2+00:00

    Hello @Rafael Massinatore , for a generic approach take a look to Validate JWT tokens using JWKS in Java.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.

    0 comments No comments