1

I'm trying to implement a registration prozess for my webapp. The problem is that the generated "userManager.GenerateEmailConfirmationTokenAsync(user.Id);" code is to long. Is there any possibility for generating a short one like this: "qwert12345asdfg6"

My UserTokenProvider is implemented like this:

        var dataProtectionProvider = new DpapiDataProtectionProvider("IdentityServer3");

        if (dataProtectionProvider != null)
        {
            UserTokenProvider = new DataProtectorTokenProvider<User>(dataProtectionProvider.Create("ASP.NET Identity")) 
            {
                TokenLifespan = TimeSpan.FromHours(3)
            };
        }

Do you have an idea what do I need to do?

ANEDev
  • 111
  • 1
  • 6
  • Why is it too long? Are you not just appening it to a url that gets passed around (e.g. via email)? – Brendan Green Oct 06 '15 at 10:45
  • Sure, but I want to generate a short code which do not have 200 signs is that possible and if yes whoch can I do this ? – ANEDev Oct 07 '15 at 06:07

1 Answers1

0

ASP.NET Identity uses the UserTokenProvider of the UserManager to generate and validate the token.

You can implement your own IUserTokenProvider<TUser, TKey> or extend the the default one than set that as UserManager.UserTokenProvider.

https://stackoverflow.com/a/24994413/659695

Community
  • 1
  • 1
Özgür Kaplan
  • 2,106
  • 2
  • 15
  • 26