How to make users log in again while they are logged in?

Hi everyone,
How to make users log in again when they move to a specific page even while they are logged in? It only can move to a log in page after they are logged out.

Language: PHP
FW: Laravel

sample code
/**

  • Redirect to the Auth0 login page
  • @return mixed
    */
    public function loginRedirect()
    {
    $authorize_params = [
    ‘scope’ => ‘openid email email_verified’,
    ];
    return \App::make(‘auth0’)->login(null, null, $authorize_params);
    }

Hi @yu.wakabayashi

Use the max_age parameter: https://auth0.com/docs/login/max-age-reauthentication

John

2 Likes

It was helpful!
max_age=0 didn’t work, so I used prompt=login!

thanks so much!

$authorize_params = [
   ‘scope’ => ‘openid email email_verified’,
   ‘prompt’ => ‘login’
];

Hi @yu.wakabayashi

Using prompt=login by itself is not sufficient (this is described in the doc page I note above). You must at least combine it with the max_age parameter.

John

1 Like

Thanks for providing that solution John, let us know @yu.wakabayashi if you have additional questions!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.