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

Specify custom token provider when using the methods which uses token provider. #964

Closed
chaiNeehujui opened this issue Sep 14, 2016 · 2 comments
Assignees

Comments

@chaiNeehujui
Copy link

Currently we can change the default token providers on TokenOptions in IdentityOptions. But in my case I need to specify custom token provider when using the method (assume that GenerateEmailConfirmationTokenAsync() and ConfirmEmailAsync()) because of the application which i made send a link if the user uses web client or send a code (Totp) if the user uses mobile client. In short, what do you think to specify token providers inline when generating and consuming the methods.

@HaoK
Copy link
Member

HaoK commented Sep 28, 2016

We are adding the ability to specify instances in the provider map, I'm not sure if that completely addresses your issue, but you will be able to configure a different instance for each method if you so like via #983

If you want to switch between different providers in a different fashion you probably have to drop down and use the lower level methods:

Generate/VerifyUserTokenAsync(user, "YourCustomProvider", "ResetPassword"), those public apis are just sugar on top of that method with the IdentityOptions.Tokens.XyzProviderName hardcoded.

@HaoK
Copy link
Member

HaoK commented Sep 30, 2016

If you are managing the token provider instances instead of the user manager, you can just directly call into the provider with the appropriate purpose/user, you don't need to go through the user manager in this case.

@HaoK HaoK closed this as completed Sep 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants