-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Identity Email Confirmation fails when token generated in a different assembly #22081
Comments
@HaoK do email tokens get wrapped up in data protection somehow? |
Yeah by default they use dataprotection |
@dotcom9 What's happening here is data protection, we take tokens and encrypt and sign them. However your applications are configured to share the keys used for this, so one app can't decrypt tokens encrypted with the other. There are a couple of things to do, first configure the apps to share a keyring, and second set the apps to have the same application identifier. How you share depends on your configuration, if, for example, both the api and web site are on the same machine you can use the file system. If they're in azure you can use blob storage. You can see the configuration options in the docs, these are the Persist* functions. Note that when you configure shared locations you also need to consider how the keys are protected in storage, these are the Protect* functions. Once you have the keys shared you also need to configure the application name otherwise application isolation is going to kick in |
This is great information, and with it I have solved my problem. Many thanks. I was unaware of Identity's dependency on DataProtection, though of course it makes sense. I couldn't find an obvious reference to it in the Identity documentation. Did I miss something, or is it an omission? I would have thought my use case was a common one. |
To be honest your use case isn't that common. I don't think I've actually seen it before, hence there being no documentation. Usually identity is self contained within the app, so it the use of data protection is handled automatically :) I'm going to go ahead and close this now, because your problem is solved, but it you encounter more problems please feel free to reopen. |
Ok, thanks for the help. |
Describe the bug
An ASPNET Identity email confirmation token generated in a different assembly fails when used in the
UserManager.ConfirmEmailAsync
method.To Reproduce
Further technical details
ASP.NET Core version: 3.1
Include the output of
dotnet --info
dotnetinfo.txt
The IDE (VS / VS Code/ VS4Mac) you're running on, and it's version
vs-info.txt
The text was updated successfully, but these errors were encountered: