Check Auth0 session in Laravel application

Hi There,

We are trying to build a middleware which will check if auth0 session exists or not, in order for us to logout from Laravel session as well on each page reload. This becomes a requirement when we are trying to implement single sign out.

For example: If another app which is also integrated with Auth0 logs out, we want to logout from Laravel as well. But right now, it retains laravel session after clearing the auth0 session.

Found this but could not use it:

// check if logged in
auth('auth0')->check();

As it always returns false.

Is it possible or any idea will be highly appreciated?

1 Like