Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Blazor服务器:外部登录(facebook)分配策略_C#_Facebook_Asp.net Identity_Blazor_Blazor Server Side - Fatal编程技术网

C# Blazor服务器:外部登录(facebook)分配策略

C# Blazor服务器:外部登录(facebook)分配策略,c#,facebook,asp.net-identity,blazor,blazor-server-side,C#,Facebook,Asp.net Identity,Blazor,Blazor Server Side,我已经创建了一个新的Blazor服务器端应用程序,并添加了facebook外部登录 我构建了身份帐户/注册,在PostSync中,我可以将用户添加到特定角色等 public async Task<IActionResult> OnPostAsync(string returnUrl = null) { returnUrl = returnUrl ?? Url.Content("~/"); ExternalLogins = (await _sig

我已经创建了一个新的Blazor服务器端应用程序,并添加了facebook外部登录

我构建了身份帐户/注册,在PostSync中,我可以将用户添加到特定角色等

    public async Task<IActionResult> OnPostAsync(string returnUrl = null)
    {
      returnUrl = returnUrl ?? Url.Content("~/");
      ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
      if (ModelState.IsValid)
      {
        var user = new IdentityUser { UserName = Input.Email, Email = Input.Email };
        var result = await _userManager.CreateAsync(user, Input.Password);
        if (result.Succeeded)
        {
          _logger.LogInformation("User created a new account with password.");

          // Add all new users to the User role
          await _userManager.AddToRoleAsync(user, CustomRoles.User);

          // check emails and assign them to specific roles
PostAsync上的公共异步任务(字符串returnUrl=null) { returnUrl=returnUrl??Url.Content(“~/”); ExternalLogins=(wait _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); if(ModelState.IsValid) { var user=newidentityuser{UserName=Input.Email,Email=Input.Email}; var result=await\u userManager.CreateAsync(用户,输入,密码); if(result.successed) { _logger.LogInformation(“用户使用密码创建了一个新帐户”); //将所有新用户添加到用户角色 wait\u userManager.AddToRoleAsync(user,CustomRoles.user); //检查电子邮件并将其分配给特定角色 但是,当用户通过facebook注册和登录时,不会触发此代码

如何将通过facebook外部登录注册和登录的用户添加到特定角色? 在身份上,这将在哪里进行