Repository navigation
Handle missing connection db records for verified auth0 sessions and improve cache handling - #950
Open
roborourke wants to merge 4 commits into
Open
roborourke wants to merge 4 commits into
roborourke wants to merge 4 commits into
By submitting a PR to this repository, you agree to the terms within the Auth0 Code of Conduct. Please see the contributing guidelines for how to create and submit a high-quality PR for this repo.
Description
This aims to fix an edge case where auth0 "resumes" a session but no account record has been created in the db so it keeps logging users out on every page request. This can happen when registering a new auth0 account for an existing WP user with a matching email address.
There are some errors in the caching here too that I needed to fix, like putting the expiry in the group parameter.
Flushing the entire cache when deleting a user is unnecessary and can be very damaging to performance on a busy site so I updated that as well, including deleting the transient.
It would be good to look into only using transients, or only
wp_cache_*functions rather than combining them as it's not necessary and adding double the number of requests needed for sites with a separate cache server, which can degrade performance rather than improve it.Testing
This change adds test coverage for new/changed/fixed functionality
Before the fix...
Create a site with an existing WP user, administrator role
Configure and Enable auth0
Login again with the user and see that no
wp_auth0_accountsrecord is createdBrowsing to the front end results in being logged out, after several redirects including to auth0's
resumeendpointWith the fix...
On the next page request to the front end, see that the redirects stop, and authentication is preserved, and the
wp_auth0_accountsrecord is createdChecklist