我一直在尝试使用 PHP 从 Office 365 获取电子邮件。在这里,我需要在没有用户登录的情况下获取电子邮件。所以我试图在没有用户登录的情况下获取访问令牌。
这是我获得访问令牌的终点。
https://login.microsoftonline.com/common/oauth2/v2.0/token
这是使用以下关键参数值的 POST 请求
client_id xxxxxx
scope https://graph.microsoft.com/.default
client_secret xxxxxx
grant_type client_credentials
然后我得到回应
{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 0,
"access_token": "xxxxxxxxRiNDcvIiwiaWF0IjoxNTMzMDYwMjA2LCJuYmYiOxxxxx"
}
之后,我不知道使用访问令牌从邮箱中获取电子邮件的 api。提前谢谢。