Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure AD + Graph API: How to reconsent after new permissions?

I have an application registration in Azure AD which has some Graph API delegated permissions set for it.

The application is simply a page in SharePoint that is making the Graph calls, authenticating with the ADAL.js library.

I now want to make an additional Graph call on the page to a new Graph API endpoint so I need to assign the application an additional permission. I set this permission in Azure AD and save. However, the user accessing the SharePoint page is never asked to reconsent to the new permissions, therefore the new Graph call fails with a 401 Unauthorised message.

I have tried this with a number of different endpoints and permissions, and I am sure I am setting the correct permissions in the application.

How can I have the consent dialog appear for users automatically when the application permissions change?

Admin consent is not an option.

like image 729
Submits Avatar asked Nov 15 '25 22:11

Submits


1 Answers

I remember having a discussion about this with a member of Azure AD team some time back and this is what he had suggested at that time (though I never tried it so it may not work).

Essentially what he suggested is that when you get Unauthorized (401) error, you redirect the user to Azure AD login again i.e. follow OAuth authorization flow again but include prompt=consent in the sign in URI. This will present the user a consent page with latest permissions. Once the user consents to the latest permission, you can redirect the user back to your application. You may find this link helpful for understanding different values for propmpt parameter: https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-openid-connect-code.

Again, I have not tried this personally so it may not work. If it doesn't, please let me know and I will remove my answer.

like image 90
Gaurav Mantri Avatar answered Nov 18 '25 15:11

Gaurav Mantri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!