401: Expired token received for JSON Web Token validation

Laravel Version
10

SDK Version
7.12.0

PHP Version
PHP 8.2

I’m using auth0 management API in a project. Everything works fine if the API is called via requests. But when it is used through laravel queue (jobs), then some time after the worker starts, it begins to constantly return a 401 error “Expired token received for JSON Web Token validation”. All settings in the auth0 config have default values.

Hey there @ngre welcome to the community!

Interesting - The default lifetime for Management API Access tokens is 24 hours. Perhaps you’re running into this?

You can create a route in your Laravel application (e.g., /keep-token-alive). Use JavaScript to periodically send an AJAX request to this request, extending the session and preventing token expiration. Make sure to include the CSRF token in the request headers.

1 Like