#Member VerifyUserTokenAsync

1 messages · Page 1 of 1 (latest)

soft mulch
#

Hey there!

I'm using Umbraco 12 and I wanted to provide a "forgot password" mechanism to frontend members.

I'm currently asking for the e-mail to get the MemberIdentityUser member and then using the MemberManager.GeneratePasswordResetTokenAsync(member) to get the token. I then encode it and send the e-mail with the encoded token.

After clicking the link in the e-mail, a controller is called with the encoded token and the user. A token validation is performed using MemberManager.VerifyUserTokenAsync(member, _options.Tokens.PasswordResetTokenProvider, UserManager<MemberIdentityUser>.ResetPasswordTokenPurpose, token)

I've also tried MemberManager.VerifyUserTokenAsync(member, "Default", "ResetPassword", token)

Both return false. I've debugged it and can confirm the token sent (before encoding) matches the received token.

What am I missing here?

Thank you 🙂

reef hill
#

Hi there! Just to be sure: you say you encoded your token, but do you also need to decode it before you call VerifyUserTokenAsync?

floral lantern
#

I assume you're not calling ResetPasswordAsync before you're verifying the token?

opaque sage
soft mulch
soft mulch
soft mulch
opaque sage
soft mulch
opaque sage
#

When you generate the token, you could store it on the member record and check that matches the token instead

soft mulch