Search code examples
phpemailoutlook-restapi

login.microsoftonline.com reject https://outlook.office.com/mail.write scope


I try to modify the sample from the dev.outlook.com to send emails to selected contacts. Unmodified example works fine, but when I added scope "https://outlook.office.com/mail.write" to oauth.php i receive error.

AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope openid //outlook.office.com/mail.read //outlook.office.com/mail.write is not valid.

Why it is rejected?


Solution

  • The actual scope you want is https://outlook.office.com/mail.readwrite, and you should replace the https://outlook.office.com/mail.read one with that (since it includes read). You will probably also want https://outlook.office.com/mail.send if you plan on sending mail.