How to fix IUserTwoFactorTokenProvider<TUser> error

Published on

I recently experienced the NotSupportedException: No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered error when trying to update a user and generate a password reset token via ASP.NET 5 Identity. This problem likely also exists in ASP.NET Core too.

It turns out that this error is caused by a missing provider for the identity system.

You can fix the problem by making a small change within the ConfigureServices method inside Startup.cs.

I just had to add .AddEntityFrameworkStores<ApplicationDbContext>() and .AddDefaultTokenProviders() to my identity provider.

            services.AddIdentity<IdentityUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)

And that's it, an extremely easy fix. You just need to rebuild the solution and try again after making the change.

Article Categories: # .net # c# # identity
Date Published: Aug 15, 2020


A tech blog by Andy P. I talk about coding, enterprise software development, tech, games design & other things that interest me.

Signup To The Newsletter

I try to post a new interesting article every saturday.

IT Asset Management

Our friends at AssetPad are building a complete online solution for managing the IT assets within your organisation. With barcodes and documentation tools.