Hi @Abhay Chandramouli • Thank you for reaching out.
Yes, you can extend the expiry time of the Access Token acquired for Graph API. For this purpose, you need to perform the below steps in your B2C tenant:
- Navigate to Azure AD > Enterprise Applications > Set Application Type to All Application > Search for GraphAggregatorService and copy the object ID.
- Run the below PowerShell script as Global Administrator to set the Access Token Lifetime to 8 hours for example. (Maximum can be 24 hours) Connect-AzureAD
$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"08:00:00"}}') -DisplayName "GraphAPITokenLifetime" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"
Get-AzureADPolicy -Id $policy.Id
$sp = Get-AzureADServicePrincipal -ObjectId Object_ID_Copied_in_Step_1
Add-AzureADServicePrincipalPolicy -Id $sp.ObjectId -RefObjectId $policy.Id
Once done, try to acquire a new Access Token for Graph API and notice the expiry time set to 8 hours (28799 seconds).
-----------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.