auth0_state
cookie in the browser via Javascript when the Lock login form is shown (on wp-login.php
or any other page when using a shortcode or widget).state
URL parameter if the Auth0 login was successful.auth0_state
cookie. If it’s valid, then the login process continues. If not, the process stops and an “Invalid state” error message is shown./index.php
on a regular install) if it has an Auth0 URL parameter.
Check to see if your server’s time is not set properly. The BeforeValidException
error can occur when the token is perceived to have been generated before the current time, which can happen if the server times are off. You can check server time by using echo current_time( 'c' )
. A temporary workaround may also be to modify the plugin to add a time offset if you cannot modify the server time, but it should be fixed for production.
If that does not solve the issue, continue with the troubleshooting steps below.
auth0_state
auth0_nonce
auth0
code
state
id_token
auth0_state_cookie_name
filter in your theme or a custom plugin. To learn more about the auth0_state_cookie_name
filter, read Extend Login by Auth0 WordPress Plugin. For additional information, see the related GitHub issue and explore its fix.
auth0_state
with a randomly-generated valuestate
URL parameter.wp-login.php
page where that cookie and URL parameter will be set automatically. If you want to continue to use a custom-built /authorize
URL, you can see the code that runs this process in the GitHub repository.
yourdomain.com/index.php?auth0=1
) directly or a second time after the authorization code has been exchanged, the invalid state error might display. This indicates that the state has already been verified and deleted.
auth0_state
cookie is being set (in Chrome, View > Developer > JavaScript Console > Application tab > Storage on the left > Cookies > domain being tested, look for an auth0_state
cookie with a non-empty value).
/assets/js/lock-init.js
. You can view this code on GitHub.wpAuth0LockGlobal.settings.auth.params.state
(view sample JSON). Make a note of this value (you’ll need it in a following step).wp-config.php
, so you can do a test install. WARNING: This will break login for the WordPress site being tested, so use it only on a non-production install.
Array()
with no additional values, then one of two things could be happening:
Cache-Control
with a non-zero max-age
, an x-cache
of something other than MISS
, or any other clue that this page is being served from a cache.
set-cookie
includes a directive like auth0_state=deleted
to confirm the validation process is happening.
state
parameter in the URL matches the one recorded from the cookie being set in step #3 above.
wp-config.php
and refresh the callback URL. You should see the “Invalid state” message again. If any caching changes were made, attempt the login process all the way through (make sure to clear your cookies and browser cache for the site before testing).
lib/WP_Auth0_LoginManager.php
, output the values of the stored and returned state and stop the process after. Just before line 148, add:
state
value in $_REQUEST
exists and matches the auth0_state
value in $_COOKIE
.
$_COOKIE
state value has changed somewhere in the process.wordpress
. Also include: