Outlook API OAuth2 offline access / persistent access using php

I followed the tutorial below to get mail using the outlook api. This works, but requires the user to log in every time to provide access. Is there a way to provide permanent / offline access? Similar to how gmail api works (access to when you're not on the keyboard)

https://dev.outlook.com/RestGettingStarted/Tutorial/php

+4
source share
2 answers

Absolutely! To access offline, you need to add an area offline_accessto the requested areas. This will send the update token along with your access token. You can use the update token to get a new access token when the current one expires. See the “Update Access Token” section of https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols/#oauth2-authorization-code-flow .

+4
source

Here is the actual line you need to add to the scope:

offline_access%20openid%20email%20profile

A basic scope example:

"openid+https%3A%2F%2Foutlook.office.com%2Fmail.read+https%3A%2F%2Foutlook.office.com%2Fcalendars.read+offline_access%20openid%20email%20profile"

+1
source

Source: https://habr.com/ru/post/1606609/


All Articles