cornflourblue / aspnet-core-3-signup-verification-api

ASP.NET Core 3.1 - Boilerplate API with Email Sign Up, Verification, Authentication & Forgot Password
https://jasonwatmore.com/post/2020/07/06/aspnet-core-3-boilerplate-api-with-email-sign-up-verification-authentication-forgot-password
MIT License
226 stars 93 forks source link

Error when we long the account id to ulong #18

Closed mjza closed 3 years ago

mjza commented 3 years ago

I need to upgrade this implementation by changing the id of the account to ulong. It can run, register account, verify the email, but when I try /accounts it shows unauthorized error.

How can I do this upgrade that

var account = (Account)context.HttpContext.Items["Account"];

could find the account?

mjza commented 3 years ago

I found the reason, we need to change the line 51 in JwtMiddleware like following:

var accountId = ulong.Parse(jwtToken.Claims.First(x => x.Type == "id").Value);