小编mel*_*erg的帖子

使用http发布请求在具有Graph API的Azure Active Directory(B2C)中创建新用户

我以前一直使用Active Directory身份验证库(ADAL)以编程方式添加用户,但是现在我需要定义“ signInNames”(=用户电子邮件),而ADAL似乎无法实现(请告诉我即时消息是否错误) 。

现在,我尝试按照MSDN上的文档以编程方式使用HTTP POST添加新用户(本地帐户)。

//Get access token (using ADAL)
var authenticationContext = new AuthenticationContext(AuthString, false);
var clientCred = new ClientCredential(ClientId, ClientSecret);
var authenticationResult = authenticationContext.AcquireTokenAsync(ResourceUrl, clientCred);
var token = authenticationResult.Result.AccessToken;


//HTTP POST CODE
const string mail = "new@email.com";
// Create a new user object.
var user = new CustomUser
{
    accountEnabled = true,
    country = "MS",
    creationType = "LocalAccount",
    displayName = mail,
    passwordPolicies = "DisablePasswordExpiration,DisableStrongPassword",
    passwordProfile = new passwordProfile { password = "jVPmEm)6Bh", forceChangePasswordNextLogin = true …
Run Code Online (Sandbox Code Playgroud)

c# adal azure-ad-graph-api

6
推荐指数
2
解决办法
8580
查看次数

标签 统计

adal ×1

azure-ad-graph-api ×1

c# ×1