Get a session
Here you will learn, how to update a session.
First, we have to initialize the class.
use ZitadelPhpClient\Session\Get;
$get_session = new Get($settings);
$get_session->setSessionId("123456789");
$get_session->setSessionToken("ABCDEFGHIJKLMNOP");
Perform the Request
try {
$get_session->get();
} catch (Exception $e) {
echo $e->getMessage();
}
Access the session data
After performing the request, you can access the data.
If no data is sent back from the Zitadel API for e.g. 2FA tokens, an error will occur when trying to access the data.
Some functions return a date in the format YYYY-MM-DDThh:mm:ss.fZ
e.g. 2024-04-08T14:37:09.846600Z
.
Session data
Creation date
$get_session->getCreationDate();
Change date
$get_session->getChangeDate();
Lifetime
$get_session->getLifetime();
User data
User verification date
$get_session->getUserVerifiedAt();
User Id
$get_session->getUserId();
Login Name
Returns the login name e.g. doe@your-zitadel-instance.com
$get_session->getUserLoginName();
Display Name
$get_session->getUserDisplayName();
Organization Id
$get_session->getUserOrganizationId();
Password Verification Date
$get_session->getPasswordVerifiedAt();
IDP Verification Date
$get_session->getIdpVerifiedAt();
OTP Email Verification Date
$get_session->getOtpEmailVerifiedAt();
TOTP Verification Date
$get_session->getTotpVerifiedAt();
OTP SMS VerifiedAt
$get_session->getSmsVerifiedAt();
Last modified: 08 April 2024