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

VerifyEmail in AccountsController.cs should be HttpGet? #13

Open jaybo opened 3 years ago

jaybo commented 3 years ago

I was puzzling over why I couldn't get email verification to work, and came up with this solution:

Current code in AccountsControlelr.cs, line 70.

[HttpPost("verify-email")]
public IActionResult VerifyEmail(VerifyEmailRequest model)
{
    ...
}

But clicking on an email link only does a GET request, correct? So I changed the above to:

[HttpGet("verify-email")]
public IActionResult VerifyEmai.([FromQuery] VerifyEmailRequest model)
{
    ...
}

and it seems to work. I don't think this affects idempotency since then internal state change isn't visible to clients, yes?