Пример #1
0
 /**
  * oAuth2 authorization. If the acess_token needs to be refreshed pass $refresh_token as first parameter,
  * if this is the first time getting access_token from user, then set the first parameter to false, pass the auth code
  * in the second.
  * @param bool $refresh_token
  * @param bool $auth_code
  * @return array $tokens
  */
 function authorize($refresh_token = FALSE, $auth_code = FALSE)
 {
     $auth = new Authorize($this->conn, $this->api_key, $this->api_secret);
     $tokens = $refresh_token ? $auth->refreshAccessToken($refresh_token) : $auth->getAccessToken($auth_code);
     !$tokens ? $auth->getAuthorizationCode() : $this->conn->setAccessData($tokens['access_token'], $tokens['refresh_token']);
     return $tokens;
 }