Пример #1
0
 protected function parseToken($token)
 {
     if (!is_array($token)) {
         throw new \RuntimeException('Not an array. $token - ' . print_r($token, true));
     }
     $data = ['application_key' => $this->publicKey, 'method' => 'users.getCurrentUser', 'access_token' => $token['access_token'], 'format' => 'json'];
     $response = ApiOd::request($data, $this->getSecret());
     if (isset($response['error'])) {
         throw new \RuntimeException($response['error']);
     }
     $token['user_id'] = $response['uid'];
     $token['expires_in'] = static::TOKEN_EXPIRES_IN;
     return $token;
 }