Using Microsoft Graph with delegated permission in script

Sebastian M 20 Reputation points
2023-11-20T17:59:46.0766667+00:00

We are trying to access to Microsoft Graph API using a delegated permission without interaction with the user (In a daemon app).

We tried OAuth 2.0 On-Behalf-Of flow but this flow require user to logging in a browser.

We tried OAuth 2.0 Resource Owner Password Credentials but this flow is not supported with AD FS used to authenticate on-premises accounts.

¿How can we get a token in an autonomous way?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,847 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 41,286 Reputation points
    2023-11-21T06:41:36.43+00:00

    Hi @Sebastian M

    You cannot use delegated permissions within a daemon. The daemon usually runs on the backend without user interaction, it only supports application permissions rather than delegated permissions, and the corresponding authentication flow is the client credentials flow.

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.