Usermanager generate email confirmation token sometimes returns null

Alex 0 Reputation points
2024-09-27T16:40:25.5433333+00:00

Why is it that sometimes the _userManager.GenerateEmailConfirmationTokenAsync(user); returns null. It's very rare to happen but it is happening and I need to know the reason behind it.

This is my current configuration for Identity

builder.Services.AddIdentity<ApplicationUser, ApplicationRole>(options =>
   {
       options.SignIn.RequireConfirmedAccount = true;
       options.Password.RequireDigit = false;
       options.Password.RequireNonAlphanumeric = false;
       options.Password.RequireUppercase = false;
       options.Password.RequiredLength = 8;
       options.Password.RequiredUniqueChars = 0;
   })
    .AddErrorDescriber<LocalizedIdentityErrorDescriber>() // Add the localization for identity validation messages
    .AddEntityFrameworkStores<ApplicationDbContext>()
    .AddDefaultTokenProviders();
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,573 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,962 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.