* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function __construct()
{
parent::__construct();
$this->auth0 = new Auth0([
'domain' => 'dev-jvei8yft.us.auth0.com',
'client_id' => 'bKb4PBJWGef7Tj1A1suZWEYxVn3zxRds',
'client_secret' => 'sanmxJBqTwNR4ywjM3dlxxI4ntcSM8_qmi0ZP8OdSZTvPqe6LUB5g3NFIteB11QV',
'redirect_uri' => 'https://uat.tripnomics.com/reconciler/authtest/dashboard',
// 'scope' => 'openid profile email',
]);
}
public function index(){
$userInfo = $this->auth0->getUser();
if (!$userInfo) {
$this->auth0->login();
} else {
redirect('authtest/dashboard');
}
}
public function dashboard(){
$userInfo = $this->auth0->getUser();
if (!$userInfo) {
redirect('authtest');
} else {
print_r($userInfo);
echo 'Welcome '.$userInfo['nickname'].' to reconciler.
logout';
}
}
public function logout(){
$return_to = 'https://uat.tripnomics.com/reconciler/authtest';
// echo sprintf('http://%s/v2/logout?client_id=%s&returnTo=%s', 'dev-jvei8yft.us.auth0.com', 'bKb4PBJWGef7Tj1A1suZWEYxVn3zxRds', $return_to);
// exit;
$this->auth0->logout();
$logout_url = sprintf('http://%s/v2/logout?client_id=%s&returnTo=%s', 'dev-jvei8yft.us.auth0.com', 'bKb4PBJWGef7Tj1A1suZWEYxVn3zxRds', $return_to);
header('Location: ' . $logout_url);
die();
}
}