Hello all,
I am trying to achieve an SSO login method with EspoCRM.
I successfully setup an SAML exchange with Azure Active Directory and I am able to login on it.
on return, I reach a callback URL within ESPO where I can get from parameters all the information I need to recognise the user.
I am generating an Auth Token with the following Code :
I am then generating a Cookie :
However, if I then go to any page of the CRM, I am not logged.
I check in the DB, the Auth Token is present and the Cookie is also created on my browser.
Is there a method we can call to login an user (for example there is a login method in appplication/Espo/Core/Utils/Auth.php).
Is there any "easy"way to call such method that will create Auth Token / Cookie the right way ?
Best Regards,
Chris
I am trying to achieve an SSO login method with EspoCRM.
I successfully setup an SAML exchange with Azure Active Directory and I am able to login on it.
on return, I reach a callback URL within ESPO where I can get from parameters all the information I need to recognise the user.
I am generating an Auth Token with the following Code :
PHP Code:
$authToken = $this->getEntityManager()->getEntity('AuthToken');
$token = $this->generateToken();
$secret = $this->generateToken();
$authToken->set('token', $token);
$authToken->set('secret', $secret);
$authToken->set('hash', $hash);
$authToken->set('ipAddress', $_SERVER['REMOTE_ADDR']);
$authToken->set('userId', $userID);
$authToken->set('lastAccess', date('Y-m-d H:i:s'));
$authToken->set('isActive', true);
$this->getEntityManager()->saveEntity($authToken);
PHP Code:
setcookie('auth-token-secret', $secret, time() + (86400 * 30), "/");
setcookie('auth-token', $token, time() + (86400 * 30), "/");
setcookie('auth-username', '$userName', time() + (86400 * 30), "/");
I check in the DB, the Auth Token is present and the Cookie is also created on my browser.
Is there a method we can call to login an user (for example there is a login method in appplication/Espo/Core/Utils/Auth.php).
Is there any "easy"way to call such method that will create Auth Token / Cookie the right way ?
Best Regards,
Chris
Comment