【发布时间】:2017-10-31 13:19:27
【问题描述】:
我目前正在尝试在我的应用程序启动时自动设置图形服务。我有以下代码:
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(sharedOptions =>
{
sharedOptions.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
sharedOptions.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
})
.AddAzureAd(options =>
{
Configuration.Bind("AzureAd", options);
})
.AddCookie();
services.AddMvc();
}
在 AddAzureAd 内部或之后,我想注册并配置一个 GraphService 以连接到 MS AAD Graph Api https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-graph-api
但我不知道如何获得每个示例都提到的 accesstoken。我从 Graph API 中勾选了模板“读取”上的框,所以我虽然这会自动配置,但遗憾的是它不是。
【问题讨论】:
标签: asp.net azure asp.net-core azure-active-directory msal