Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot complete registration or any other process requiring email and validations. #494

Closed
Unsigned-Char opened this issue Aug 13, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@Unsigned-Char
Copy link

Describe the bug

  1. The documentation is not clear about using SendGrid of another email provider. Providing working elements for each case would have a significant impact since each case seems to be partially implemented.

  2. After implementing an email client, the registration and other processes like email updates and password changes, etc., that rely on security tokens to be generated, wouldn't and cannot work under the current architecture.

  • Mainly, the UserManager and TokenProvider are different instances between the generation and validation of those tokens since they are disposed of and instantiated on each use of services.
    
  • The tokens must be validated by the same instance that generated them and the user must also have an unchanged SecurityStamp otherwise the TokenProvider validation process always returns InvalidToken.
    

To Reproduce
Steps to reproduce the behavior:

  1. Run TheIdServer
  2. Register a new user, rinse and repeat.

Expected behavior
A functional registration and validation process where the user receives an email to confirm its address or changes.
The link he receives and the token it contains must be valid upon confirmation.

Logs
If applicable, add logs to help explain your problem.

Platform (please complete the following information):

  • OS: Windows 10 Pro
  • .Net Core Version 5.0.9

Additional context

image

image

image

image

@Unsigned-Char Unsigned-Char added the bug Something isn't working label Aug 13, 2021
@aguacongas
Copy link
Member

Hi @Unsigned-Char , thx to contribute again.
Can you post your configuration and tell me how you implement the service please ?

@Unsigned-Char
Copy link
Author

Unsigned-Char commented Aug 18, 2021

The following :

  • Windows 10 Pro
  • Clean Visual Studio 2019 Community
  • dot.NET SDK 5.0.9
  • A clone of Master
  • No change to appSettings.json except adding my SendGrid credentials.

I simply compiled the solution and ran TheIdServer in debug mode.

I used the admin interface to register and change the email address afterward. In either case, the token validation always returns an invalid token response.

ConfirmEmailChange.cshtml.cs : 48:13 : var result = await _userManager.ChangeEmailAsync(user, email, code);

ConfirmEmail.cshtml.cs : 43:13 : var result = await _userManager.ConfirmEmailAsync(user, code);

I don't have the debug information for Microsoft's UserManager, but I'm guessing the tokens cannot be validated because they cannot be found, the validators or stores are different instances than those when they were created.

image

@aguacongas
Copy link
Member

Ok, the issue is in the Identity store implementation, I'll do my best to fix it

aguacongas pushed a commit that referenced this issue Aug 21, 2021
## [3.0.1](3.0.0...3.0.1) (2021-08-21)

### Bug Fixes

* build solution issue ([b950524](b950524)), closes [#493](#493)
* identity store issues ([7d12577](7d12577)), closes [#494](#494)
* mail confirmation ([72a2915](72a2915))
* update packages ([ebded6d](ebded6d))
* update packages ([c4efd62](c4efd62))
* update packages ([3b71923](3b71923))
* update packages ([c8fab6a](c8fab6a))
* update packages ([7cf2b83](7cf2b83))
* update packages ([88d5bd6](88d5bd6))
* update packages ([0007c2a](0007c2a))
* update packages ([139f869](139f869))
* update packages ([ad0c4db](ad0c4db))
* update packages ([fc2cb13](fc2cb13))
* update packages ([3196486](3196486))
* update packages ([e1fc95b](e1fc95b))
* update packages ([8923795](8923795))
* update packages ([c7edb5d](c7edb5d))
* update packages ([09b1337](09b1337))
* update packages ([71e5759](71e5759))
* update packages ([43ff078](43ff078))
* update packages ([a9c94df](a9c94df))
* update packages ([eff7b8e](eff7b8e))
* update packages ([6c5e29e](6c5e29e))
* update packages ([2d87f93](2d87f93))
* update packages ([454160a](454160a))
* update packages ([0cc4401](0cc4401))
* update packages ([05fcdc3](05fcdc3))
* update packages ([84b5296](84b5296))
* update packages ([b707643](b707643))
* update packages ([b9dcbf3](b9dcbf3))
* update packages ([ea25589](ea25589))
* update packages ([d478d66](d478d66))
* update packages ([33999a4](33999a4))
* update packages ([55c1f7e](55c1f7e))
* update packages ([7060a48](7060a48))
* update packages ([6f4b62c](6f4b62c))
* update packages ([25ffed9](25ffed9))
* update packages ([f0d59ce](f0d59ce))
* update packages ([0a30673](0a30673))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants