Part-2 Create a TokenLifetimePolicies

Create a policy

Login to Microsoft Graph

Make sure to set consent for Policy Read and Write Application Configuration.

  1. Use the Get to check if any policy exists in the environment.

Get: https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies

I have test tenant, so no policy exists.

2. Let’s Create a new Lifetime token Policy.

Use Json value as mentioned in table change Display name\Policy hour (8:00:00) eight hours as per your need and post it.

{
    “definition”: [
        “{\”TokenLifetimePolicy\”:{\”Version\”:1,\”AccessTokenLifetime\”:\”8:00:00\”}}”
    ],
    “displayName”: “Eight Hour Token policy”,
    “isOrganizationDefault”: true
}

Snapshot.

Response

Seems all ok with 201 return code.

Time to validate whether access token is showing 8 hours expire window.

Re-Generate a new token from Part-1.

JSON Web Tokens – jwt.io

All good token is showing 8 hours expire window.

By Bharat