Error validating access token wordpress
To do so we need to add a service which is responsible to send emails to users, in my case I’ll use Send Grid which is service provider for sending emails, but you can use any other service provider or your exchange change server to do this.If you want to follow along with this tutorial you can create a free account with Send Grid which provides you with 400 email per day, pretty good!This is easy to implement, all you need to do is to open controller “Accounts Controller” and paste the code below: Notice how we are calling the method “Change Password Async” and passing the authenticated User Id, old password and new password.If you tried to call this endpoint, the extension method “Get User Id” will not work because you are calling it as anonymous user and the system doesn’t know your identity, so hold on the testing until we implement authentication part.
Important Note: It is recommenced to validate the password before confirming the email account, in some cases the user might miss type the email during the registration, so you do not want end sending the confirmation email for someone else and he receives this email and activate the account on your behalf, so better way is to ask for the account password before activating it, if you want to do this you need to change the “Confirm Email” method to POST and send the Password along with user Id and code in the request body, you have the idea so you can implement it by yourself 🙂 In some cases you want to enforce certain rules on the username and password when users register into your system, so ASP.
NET Identity 2.1 system offers this feature, for example if we want to enforce that our username only allows alphanumeric characters and the email associated with this user is unique then all we need to do is to set those properties in class “Application User Manager”, to do so open file “Application User Manager” and paste the code below inside method “Create”: The same applies for the password policy, for example you can enforce that the password policy must match (minimum 6 characters, requires special character, requires at least one lower case and at least one upper case character), so to implement this policy all we need to do is to set those properties in the same class “Application User Manager” inside method “Create” as the code below: In some scenarios you want to apply your own custom policy for validating email, or password.
This can be done easily by creating your own validation classes and hock it to “User Validator” and “Password Validator” properties in class “Application User Manager”.
Note: There is another property named “Sms Service” if you would like to use it for sending SMS messages instead of emails. Eventually this link will be sent to the registered user to the email he used in registration, and the user needs to click on it to activate the account, the route “Confirm Email Route” which maps to this activation link is not implemented yet, we’ll implement it the next step.
Notice how we are setting the expiration time for the code (token) send by the email to 6 hours, so if the user tried to open the confirmation email after 6 hours from receiving it, the code will be invalid. Lastly we need to send the email including the link we’ve built by calling the method “Send Email Async” where the constructor accepts the user Id, email subject, and email body.
Okay, now here for the report: Morning was somewhat quiet but the traffic has been picking up since…