我正在连接到 Microsoft Graph Api 以下载所有用户电子邮件。我可以为进行身份验证的用户下载所有电子邮件,它适用于范围Mail.ReadBasic。但是,当我尝试使用范围Mail.ReadBasic.All以“全局管理员”身份进行身份验证时,出现以下错误:
AADSTS650053: The application 'xxx' asked for scope 'Mail.ReadBasic.All' that doesn't exist on the resource '00000003-0000-0000-c000-000000000000'. Contact the app vendor.
该应用已在 Azure 门户的设置中允许范围 Mail.ReadBasic.All。
def authenticate():
parameters = {
"client_id": settings["app_id"],
"response_mode": "form_post",
"scope": "Mail.ReadBasic.All User.ReadBasic.All offline_access",
"response_type": "code",
"redirect_uri": "http://localhost:8000/",
"tenant": settings["tenant"]
}
url = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?" + urllib.parse.urlencode(parameters)
return url