Hi,
Apologies if I’m missing something obvious but in the PHP package I’m passing state as a parameter to login and login successfully:
$auth0->login($_SERVER['HTTP_REFERER']);
However when I try to retrieve userInfo after the login I successfully get the user’s details but I can’t find state info listed. Should I be calling something else:
$userInfo = $auth0->getUser();
var_dump($userInfo);
I want to then use this state referrer information to send the user back to where they started pre-login. I seen the docs on this flow but the specifics of how to retrieve state post-login are not included.
Thanks
Here’s my full login flow - perhaps I don’t even need to retrieve state I can just plug it directly in with redirect somewhere?
<?php
require __DIR__ . '/vendor/autoload.php';
// require __DIR__ . '/dotenv-loader.php';
use Auth0\SDK\Auth0;
$domain, client secrets here etc...
$redirect_uri = "http://localhost:3000/auth/login_check.php";
$audience = "";
if($audience == ''){
$audience = 'https://' . $domain . '/userinfo';
}
$auth0 = new Auth0([
'domain' => $domain,
'client_id' => $client_id,
'client_secret' => $client_secret,
'redirect_uri' => $redirect_uri,
'audience' => $audience,
'scope' => 'openid profile',
'persist_id_token' => true,
'persist_access_token' => true,
'persist_refresh_token' => true,
]);
\Firebase\JWT\JWT::$leeway = 2400000;
$auth0->login($_SERVER['HTTP_REFERER']);