/** * Request a access token. * * @param string $code The authorization code from Spotify. * * @return bool */ public function requestToken($code) { $parameters = array('client_id' => $this->getClientId(), 'client_secret' => $this->getClientSecret(), 'code' => $code, 'grant_type' => 'authorization_code', 'redirect_uri' => $this->getRedirectUri()); $response = Request::account('POST', '/api/token', $parameters); $response = $response['body']; if (isset($response->access_token)) { $this->accessToken = $response->access_token; $this->expires = $response->expires_in; $this->refreshToken = $response->refresh_token; return true; } return false; }