Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

IUserTokenProvider does not exists? #1018

Closed
rudolfdobias opened this issue Nov 6, 2016 · 1 comment
Closed

IUserTokenProvider does not exists? #1018

rudolfdobias opened this issue Nov 6, 2016 · 1 comment

Comments

@rudolfdobias
Copy link

Hello, I'm confused with the token providers registration.

When calling UserManager<T>.GeneratePasswordResetTokenAsync without any token provider registered it fails with No IUserTokenProvider named 'Default' is registered.

We cannot register IUserTokenProvider since it does not longer exists.

From UserManager source code I figured out that the correct iface is IUserTwoFactorTokenProvider<T> but the token generation still does not work until we assign the token provider manually:

services.AddIdentity<User, Role>(options =>
            {
                ...
                options.Tokens.ProviderMap.Add("Default", new TokenProviderDescriptor(typeof(IUserTwoFactorTokenProvider<User>)));
            })

So is this a bug or feature? How is the correct approach?

Thanks.

PS: StackOverflow thread about this is here

@HaoK
Copy link
Member

HaoK commented Nov 7, 2016

Typically the token providers are registered by AddDefaultTokenProviders https://github.com/aspnet/Identity/blob/dev/src/Microsoft.AspNetCore.Identity/IdentityBuilder.cs#L167

But you can manually add it instead if you prefer as well as you are doing.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants