150 public function get() {
151 $token = $this->settings[
"serviceUserToken"];
153 curl_setopt_array($curl, array(
154 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/sessions/$this->sessionId?sessionToken=$this->sessionToken",
155 CURLOPT_RETURNTRANSFER =>
true,
156 CURLOPT_ENCODING =>
'',
157 CURLOPT_MAXREDIRS => 10,
158 CURLOPT_TIMEOUT => 0,
159 CURLOPT_FOLLOWLOCATION =>
true,
160 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
161 CURLOPT_CUSTOMREQUEST =>
'GET',
162 CURLOPT_HTTPHEADER => array(
163 "Content-Type: application/json",
164 "Accept: application/json",
165 "Authorization: Bearer $token"
169 $response = json_decode(curl_exec($curl));
170 if(isset($response->code)) {
171 throw new Exception(
"Error-Code: " . $response->code .
" Message: " . $response->message);
173 $this->creationDate = $response->session->creationDate;
174 $this->changeDate = $response->session->changeDate;
175 $this->userVerifiedAt = $response->session->factors->user->verifiedAt;
176 $this->userId = $response->session->factors->user->id;
177 $this->userLoginName = $response->session->factors->user->loginName;
178 $this->userDisplayName = $response->session->factors->user->displayName;
179 $this->userOrganizationId = $response->session->factors->user->organizationId;
181 if (isset($response->session->factors->password->verifiedAt)) {
182 $this->passwordVerifiedAt = $response->session->factors->password->verifiedAt;
185 if (isset($response->session->factors->intent->verifiedAt)) {
186 $this->idpVerifiedAt = $response->session->factors->intent->verifiedAt;
189 if (isset($response->session->factors->otpEmail->verifiedAt)) {
190 $this->otpEmailVerifiedAt = $response->session->factors->otpEmail->verifiedAt;
193 if (isset($response->session->factors->otpSms->verifiedAt)) {
194 $this->optSmsVerifiedAt = $response->session->factors->otpSms->verifiedAt;
197 if (isset($response->session->factors->totp->verifiedAt)) {
198 $this->totpVerifiedAt = $response->session->factors->totp->verifiedAt;
201 if (isset($response->session->expirationDate)) {
202 $this->expirationDate = $response->session->expirationDate;