Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft graph background authentication (no user interaction)

The situation is: my web app has your own authentication provider, independent from Microsoft Active Directory, then I want to use the Microsoft Graph... so is it possible to make an authentication to use the Microsoft Graph, on background without the interaction of the user? If yes, how? Ty.

like image 495
solrac Avatar asked Mar 18 '26 08:03

solrac


1 Answers

Microsoft Graph is dependent on the user being authenticated against Azure AD endpoint. At one point, your app needs to prompt the user to sign-in using his/her company's or personal account, and the username/password validation and user consent needs to happen for your application being able to access the scopes you need to request.

If your app is a traditional Web App, then you can use the code grant flow to get an authorization code and then exchange it to get a refresh token (of course the user has to consent to the scopes you are requesting). Your app can also cache the refresh token so you don't need to prompt the user every time.

You also did not give a lot of information on what your scenario, but another possibility is run your app as 'app context' so your application don't depend on user's delegation or consent - this scenario depends on admin consent. See this document for more information.

like image 100
Andre Teixeira Avatar answered Mar 23 '26 20:03

Andre Teixeira



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!