163 $token = $this->settings[
"serviceUserToken"];
165 curl_setopt_array($curl, array(
166 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/users/$this->userid",
167 CURLOPT_RETURNTRANSFER =>
true,
168 CURLOPT_ENCODING =>
'',
169 CURLOPT_MAXREDIRS => 10,
170 CURLOPT_TIMEOUT => 0,
171 CURLOPT_FOLLOWLOCATION =>
true,
172 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
173 CURLOPT_CUSTOMREQUEST =>
'GET',
174 CURLOPT_HTTPHEADER => array(
175 "Content-Type: application/json",
176 "Accept: application/json",
177 "Authorization: Bearer $token"
181 $response = json_decode(curl_exec($curl));
182 if(isset($response->code)) {
183 throw new Exception(
"Error-Code: " . $response->code .
" Message: " . $response->message);
185 $this->rawUserData = json_encode($response->user);
187 $this->userState = $response->user->state;
188 $this->userName = $response->user->username;
189 $this->loginNames = $response->user->loginNames;
190 $this->preferredLoginName = $response->user->preferredLoginName;
191 $this->givenName = $response->user->human->profile->givenName;
192 $this->familyName = $response->user->human->profile->familyName;
193 $this->nickName = $response->user->human->profile->nickName;
194 $this->displayName = $response->user->human->profile->displayName;
195 $this->preferredLanguage = $response->user->human->profile->preferredLanguage;
197 if(isset($response->user->human->profile->avatarUrl)) {
198 $this->profilePicture = $response->user->human->profile->avatarUrl;
202 $this->gender = $response->user->human->profile->gender;
203 $this->email = $response->user->human->email->email;
205 if(isset($response->user->human->email->isVerified)) {
206 $this->isEmailVerified = $response->user->human->email->isVerified;
208 $this->isEmailVerified =
false;
211 if(isset($response->user->human->phone->phone)) {
212 $this->phone = $response->user->human->phone->phone;
215 if(isset($response->user->human->phone->isVerified)) {
216 $this->isPhoneVerified = $response->user->human->phone->isVerified;
218 $this->isPhoneVerified =
false;