Testing Entra ID SaaS OIDC Apps With JWT.ms


JWT.ms is an app that will show you the contents of any JSON Web Token (JWT) issued by Entra ID that you have access to and can paste into the top field in the browser.

But you can also use it to test apps in Entra ID – you can publish a web app that has https://jwt.ms as the Redirect URI and optionally customize claims and then login to that app and see your token.

You can do this in a workforce or external tenant (Entra ID or Entra ID External tenants) or the older Azure B2C service as well. Start by opening Entra Admin Portal and signing into the tenant you wish to test logins against. From “App Registrations” create a new app registration:

In the below I have created an app registration called “JWT and Custom Claims Demo App” and only in this tenant (single tenant). Select a Web app and set the Redirect URI to https://jwt.ms:

Click “Register” button to make your app.

Once the app is created you need to view the managed Enterprise App. This is accessible from a link on the “Overview” page and to the right as shown:

Click this link, choose Properties, and either set “Assignment Required” to No, or if it is set to Yes, add “Users and Groups” to that view for the users allowed to use the app:

From the Single Sign-On menu click Edit for “Attributes & Claims”. This is optional, but if you add additional claims they will appear in the token and shown on JWT.ms. Additional claims can be attributes, transformations (simple code to modify the attribute values in the claim) or directory schema extensions). For example here we are adding a claim called “TownOrCity” which is the users City value:

Save any changes and go back to App Registrations from the main menu and click “Authentication” from the menu. You need to turn on both “Access Tokens” and “ID Tokens”.

From the Overview page of the app registration, view the Endpoints:

Copy the OAuth 2.0 authorization endpoint value (v2). This will be the second entry in the list if using Entra External ID, or the fifth if you are using Entra ID. Paste this endpoint into Notepad and then copy the Application (Client) ID from the Entra Portal as well – both these values are blurred out in my screenshot above, but shown in a red box.

Modify the endpoint URL you have pasted into Notepad by adding ?Client_ID=xxxx to the end, where xxxx = Application (Client) ID from above.

Continue to modify the URL that you will use to access the app. You need to add a nonce value, a scope value, and the Redirect URI from earlier. Finish the URL with &response_type=id_token. For example the URL for an External ID tenant will look something like this:

https://tenant.ciamlogin.com/tenant_ID/oauth2/v2.0/authorize?client_id=client_ID&nonce=123&redirect_uri=https://jwt.ms&scope=openid&response_type=id_token

Tenant ID and Client ID GUIDs are unique to your tenant and app

Open this in an in-private browser session. First as a tenant admin if you need to consent permissions, and then as a test user.

If you added any custom claims you will need to add either an app specific secret (recommended for apps that can support these, unlike this example) or for testing, modify the app manifest (under Enterprise Applications) so that “acceptMappedClaims” is set to “true”.


Posted

in

, , , ,

by

Tags:

Comments

7 responses to “Testing Entra ID SaaS OIDC Apps With JWT.ms”

  1. Dinesh Silva avatar
    Dinesh Silva

    You must update the manifest file to “acceptMappedClaims”: true. Am I correct?

    1. Brian Reid avatar

      Yes – that is covered in the last paragraph in the blog post. It will already have an entry in the manifest for acceptMappedClaims, and you need to change this from null to true.

  2. Wim Abts avatar
    Wim Abts

    When I setup my url like:
    https://tenant.ciamlogin.com/tenant_ID/oauth2/v2.0/authorize?client_id=client_ID&nonce=123&redirect_uri=https://jwt.ms&scope=openid&response_type=id_token

    tenant and client id replaced, i get this error: AADSTS50146: This application is required to be configured with an application-specific signing key. It is either not configured with one, or the key has expired or is not yet valid

    There is a secret in the application, do I have to add to the url somewhere?

    1. Brian Reid avatar

      Hi – is it a multitenant app or not? If not, so a single-tenant app, have you set “acceptMappedClaims”: true in the manifest for both External ID app and in the client (if using ID tokens). If multi-tenant then you should be doing POST requests and not a GET request. The secret would be in the POST request.

  3. nick avatar
    nick

    Hi

    Thanks for this tutorial, was able to setup the app and make it work even with custom claims.

    I was also able to publish the app to the myapps page by setting “Visible to users?” to Yes in the Properties. However when I click on the app from there I get an “App launch failed” error.
    Is there a way to add the complete URL to that page? If this were a real app that I want my users to access, how would they be able to find the correct URL? Is there a way to customize the link in the myapps page?

    1. Brian Reid avatar

      Hello. You cannot directly change the URL of the app as it appears in MyApps. Should you need to do this because the particular app does not work with MyApps (or the Apps list in Office.com), I recommend that you hide the app that you created here and add a second Enterprise App with sign-in type of “Linked” (under Single Sign-On settings). This second app can be made visible and limited to users as you describe in your comment, but the URL that appears in MyApps is the Homepage URL of this second app. So you have one app in Entra that is the actual App/Service Principal for the application (and not shown in MyApps) and a second app that is a linked app utilising a custom homepage that is the link needed to get access to your 1st app.

      1. nick avatar
        nick

        Actually, i have changed the homepage URL in the JWT Enterprise Application with this:

        https://login.microsoftonline.com//oauth2/v2.0/authorize?client_id=&nonce=test&scope=openid&response_type=id_token

        And now it works also from the link in myapps page. I get redirected to the jwt.ms with the token in the URL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.