在 Office 365 中使用多个范围 API
Use multiple scopes with the Office 365 API
我想使用 https://outlook.office.com/Mail.Read
和 https://outlook.office.com/calendars.read
这两个范围来读取经过身份验证的用户的电子邮件和日历。我按照 official .Net (WPF) tutorial 对用户进行身份验证并获取令牌。只要我的范围只是上述范围之一,它就可以正常工作。一旦我同时使用两者,我在尝试获取令牌时就不会取回令牌。
我基本上就是这样做的:
private static string[] scopes = { "https://outlook.office.com/Mail.Read", "https://outlook.office.com/calendars.read" };
// sign-in/authenticate logic (with PromptBehavior.Always/Never) from tutorial
// here, the result doesn't contain a token:
result = await authContext.AcquireTokenAsync(scopes, null, clientId, redirectUri, new PlatformParameters(PromptBehavior.Always, null));
我做错了什么?
尝试将 Mail.Read
范围更改为全部小写:
private static string[] scopes = { "https://outlook.office.com/mail.read", "https://outlook.office.com/calendars.read" };
这看起来像是 ADAL 库中的错误。我提交了 issue on GitHub.
我想使用 https://outlook.office.com/Mail.Read
和 https://outlook.office.com/calendars.read
这两个范围来读取经过身份验证的用户的电子邮件和日历。我按照 official .Net (WPF) tutorial 对用户进行身份验证并获取令牌。只要我的范围只是上述范围之一,它就可以正常工作。一旦我同时使用两者,我在尝试获取令牌时就不会取回令牌。
我基本上就是这样做的:
private static string[] scopes = { "https://outlook.office.com/Mail.Read", "https://outlook.office.com/calendars.read" };
// sign-in/authenticate logic (with PromptBehavior.Always/Never) from tutorial
// here, the result doesn't contain a token:
result = await authContext.AcquireTokenAsync(scopes, null, clientId, redirectUri, new PlatformParameters(PromptBehavior.Always, null));
我做错了什么?
尝试将 Mail.Read
范围更改为全部小写:
private static string[] scopes = { "https://outlook.office.com/mail.read", "https://outlook.office.com/calendars.read" };
这看起来像是 ADAL 库中的错误。我提交了 issue on GitHub.