Adding SignInManager

If we try to compile our project, the preceding code will produce a warning due to the SignInManager object reference being unknown. In order to fix that, we need to add another object instance to our handlers team--the SignInManager--which provides the aforementioned common interface to handle the external providers authentication flow.

We can do that on our BaseApiController, like we always did in the past; however, considering the fact that it will likely be used within the TokenController only, it's probably better to just add it there by tweaking the constructor method as shown (new lines are highlighted):

#region Constructor
public TokenController(
ApplicationDbContext context,
RoleManager<IdentityRole> roleManager,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IConfiguration configuration
)
: base(context, roleManager, userManager, configuration)
{
SignInManager = signInManager;
}
#endregion

Also, by adding the following property right after:

#region Properties
protected SignInManager<ApplicationUser> SignInManager { get; private set; }
#endregion
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.189.186