/** * Fetch refresh token * * @param string $redirectUrl * @param array $input * @return Token * @throws bazaarException */ public function token($redirectUrl, array $input = []) { $input = count($input) ? $input : $_GET; $this->guardAgainstEmptyCode($input); $code = trim($input['code']); $response = $this->client->post($this->config->url('token'), ['form_params' => ['grant_type' => 'authorization_code', 'client_id' => $this->config->clientId(), 'client_secret' => $this->config->clientSecret(), 'code' => $code, 'redirect_uri' => $redirectUrl]]); return new Token($response); }