I followed the tutorial below to get mail using outlook api. This works, but requires the user to login every time to give access. Is there a way to give permanent / offline access? Similar to how gmail api works (access to when your not at your keyboard)
Asked
Active
Viewed 3,167 times
5
-
maybe you could try [Exchange Web Services](https://github.com/jamesiarmes/php-ews) - also, see [MS Office Dev Center: Start using web services in Exchange](https://msdn.microsoft.com/en-us/library/office/jj900168(v=exchg.150).aspx) – Our Man in Bananas Sep 09 '15 at 15:51
2 Answers
8
Absolutely! In order to get offline access, you need to add the offline_access
scope to your requested scopes. This will result in a refresh token being sent along with your access token. You can use the refresh token to get a new access token when the current one expires. See the "Refresh the Access Token" section of https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols/#oauth2-authorization-code-flow.

Jason Johnston
- 17,194
- 2
- 20
- 34
1
Here is the actual string you would need to append to the scope:
offline_access%20openid%20email%20profile
A basic example of a scope:
"openid+https%3A%2F%2Foutlook.office.com%2Fmail.read+https%3A%2F%2Foutlook.office.com%2Fcalendars.read+offline_access%20openid%20email%20profile"

Enigma
- 1,247
- 3
- 20
- 51