value = $token_info['access_token']; $instance->scope = $token_info['scope']; $instance->client_id = $token_info['client_id']; $instance->user_id = self::getValueFromInfo('user_id', $token_info); $instance->user_external_id = self::getValueFromInfo('user_external_id', $token_info); $instance->user_identifier = self::getValueFromInfo('user_identifier', $token_info); $instance->user_email = self::getValueFromInfo('user_email', $token_info); $instance->user_first_name = self::getValueFromInfo('user_first_name', $token_info); $instance->user_last_name = self::getValueFromInfo('user_last_name', $token_info); $instance->auth_code = null; $instance->audience = $token_info['audience']; $instance->refresh_token = null; $instance->lifetime = intval($token_info['expires_in']); $instance->is_hashed = false; $instance->allowed_return_uris = self::getValueFromInfo('allowed_return_uris', $token_info); $instance->application_type = $token_info['application_type']; $instance->allowed_origins = self::getValueFromInfo('allowed_origins', $token_info); $instance->user_groups = self::getValueFromInfo('user_groups', $token_info); if(!empty($instance->user_groups)) { if(is_string($instance->user_groups)) $instance->user_groups = json_decode($instance->user_groups, true); } else { $instance->user_groups = []; } return $instance; } public function getAuthCode() { return $this->auth_code; } public function getRefreshToken() { return $this->refresh_token; } public function getApplicationType() { return $this->application_type; } public function getAllowedOrigins():?string { return $this->allowed_origins; } public function getAllowedReturnUris() { return $this->allowed_return_uris; } /** * @return int|null */ public function getUserExternalId() { return $this->user_external_id; } public function toJSON() { return '{}'; } public function fromJSON($json) { } /** * @return null|string */ public function getUserIdentifier(): ?string { return $this->user_identifier; } /** * @return null|string */ public function getUserEmail(): ?string { return $this->user_email; } /** * @return null|string */ public function getUserFirstName(): ?string { return $this->user_first_name; } /** * @return null|string */ public function getUserLastName(): ?string { return $this->user_last_name; } /** * @return array */ public function getUserGroups():array { return $this->user_groups; } }