Graph authentication through Client Credentials flow - Will my app have access to just my user account or to the whole organization?

前端 未结 2 1924
广开言路
广开言路 2021-01-06 00:22

I have a daemon script that needs to access my Office 365 inbox to read messages. Currently I am using basic authentication with V1.0 of the Outlook Rest API, which works we

2条回答
  •  青春惊慌失措
    2021-01-06 00:58

    That is correct. If you use Client Credentials, you are by definition using Application Scopes. These tokens have no "user" context and are therefore tenant-wide permissions. This is why Application Scopes always require Admin Consent before they can be used.

    From the documentation:

    Mail.Read (Read mail in all mailboxes)

    Allows the app to read mail in all mailboxes without a signed-in user.

    If this is just for your mailbox rather than something you're deploying to others, you can use the Authorization Code Grant with the offline_access scope to obtain both an access_token and refresh_token.

    Once you've "seeded" your app with the token, the app can use the refresh_token to obtain a new access_token when it expires. You may occasionally need to re-seed your app/service (for example, if your password changes) but otherwise, it should work without interaction.

提交回复
热议问题