I’m trying to integrate the API on my application. I’m following the documentation from https://dev.freeagent.com/docs/oauth#client-libraries. So far I’ve created the application using a developer account and a sandbox account to play with.
Following the documentation the authorisation request is working as expected and the user can approve the application (it’s listed as approved for that account). The problem is that every time that I try to exchange the authorisation token for an access token I get “Access denied”, I’ve tried different options based on previous comments by I’m not sure how to solve this.
My request looks like this:
$client = new GuzzleHttp\Client(); $response = $client->request('POST', $endpoint_url, [ 'auth' => [ $this->client_id, $this->client_secret ], 'headers' => [ 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8', 'Accept' => 'application/json' ], 'form_params' => [ 'grant_type' => 'authorization_code', 'code' => $code, 'redirect_uri' => urlencode($this->redirection_uri) ] ]);