我已经在 Azure AD B2C 中注册了应用程序。现在我想使用 MS Graph SDK在身份验证选项中分配/更改平台配置。怎么做?
我以添加带有重定向uri的Web平台为例。
web
应用程序注册中有一个属性。
我们可以更新应用程序注册以将重定向 uri ( https://localhost
)添加到此属性中。
Http 示例:
PATCH https://graph.microsoft.com/v1.0/applications/{application object id}
{
"web": {
"homePageUrl": null,
"logoutUrl": null,
"redirectUris": [
"https://localhost"
],
"implicitGrantSettings": {
"enableAccessTokenIssuance": false,
"enableIdTokenIssuance": false
}
}
}
对应的 C# 示例:
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var application = new Application
{
Web = new WebApplication
{
HomePageUrl = null,
LogoutUrl = null,
RedirectUris = new List<String>()
{
"https://localhost"
},
ImplicitGrantSettings = new ImplicitGrantSettings
{
EnableAccessTokenIssuance = false,
EnableIdTokenIssuance = false
}
}
};
await graphClient.Applications["{application object id}"]
.Request()
.UpdateAsync(application);
如果要添加移动和桌面应用程序平台,可以查看publicClient
属性,以及spa
单页应用程序平台的属性。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句