135 $token = $this->settings[
"serviceUserToken"];
137 curl_setopt_array($curl, array(
138 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/sessions/$this->sessionId",
139 CURLOPT_RETURNTRANSFER =>
true,
140 CURLOPT_ENCODING =>
'',
141 CURLOPT_MAXREDIRS => 10,
142 CURLOPT_TIMEOUT => 0,
143 CURLOPT_FOLLOWLOCATION =>
true,
144 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
145 CURLOPT_CUSTOMREQUEST =>
'PATCH',
146 CURLOPT_POSTFIELDS => json_encode($this->request),
147 CURLOPT_HTTPHEADER => array(
148 "Content-Type: application/json",
149 "Accept: application/json",
150 "Authorization: Bearer $token"
154 $response = json_decode(curl_exec($curl));
155 if(isset($response->code)) {
156 throw new Exception(
"Error-Code: " . $response->code .
" Message: " . $response->message);
158 if (isset($response->challenges->otpSms)) {
159 $this->smsCode = $response->challenges->otpSms;
162 if (isset($response->challenges->otpEmail)) {
163 $this->emailCode = $response->challenges->otpEmail;