Hi team,
I am trying Free Agent for the first time.
- I followed the Authorization documentation and managed to get the authorization code.
- When I try to get the access token, I get the below error message which is very strange (I am not using any API required for accountants). I must be doing something really silly, but I can’t seem to figure out what it is.
Looking forward to hear from you.
Cheers,
Dhanya
Hi Dhanya,
Thanks for your message and welcome to our API forum
Based on the screenshot you so helpfully provided, it looks like your POST request was made to the oauth2.googleapis.com/token
URL, rather than to the FreeAgent server. Could you try using this custom link to the Goole OAuth 2.0 playground which includes all the required configuration (apart from the OAuth Client ID and OAuth Client secret which you’ll have to populate with details from your app registered on the FreeAgent Developer Dashboard) and see how you get on?
https://developers.google.com/oauthplayground/#step3&url=https%3A//&content_type=application/json&http_method=GET&useDefaultOauthCred=unchecked&oauthEndpointSelect=Custom&oauthAuthEndpointValue=https%3A//api.sandbox.freeagent.com/v2/approve_app&oauthTokenEndpointValue=https%3A//api.sandbox.freeagent.com/v2/token_endpoint&includeCredentials=unchecked
Best wishes,
Ewa
Hi Dhanya,
After visiting this link, clicking OK! That’s fine. on the pop-up asking whether you want to keep the custom configuration, and populating the OAuth Client ID and OAuth Client secret fields, what happens when you click on Select and Authorize APIs, input any value in the scope field, and click Authorize APIs? You should be redirected to the FreeAgent login page, and provided with an authorization code after a successful sign-in to your FreeAgent Sandbox account.
You’ll then be redirected to the FreeAgent login screen.

After logging in and approving your app, you’ll come back to the Google OAuth Playground, where you can exchange the Authorization Code for an Access Token:
I hope this helps!
Best wishes,
Ewa