Issues with FreeAgent API Authentication

Hey guys… :wave:

I am having some trouble with FreeAgent API authentication and hoping someone here might be able to help. I have been trying to integrate FreeAgent into my application, but I keep running into issues when attempting to authenticate.

Here is some points that I have tried:

  • I’ve created a new application in FreeAgent and obtained the client ID and client secret.
  • I’m sending a request to the authorization endpoint with the correct parameters, but I’m not getting redirected back with the authorization code.
  • When I try to exchange the authorization code for an access token, I’m getting an error saying “invalid_grant.”

I have double-checked my client ID, client secret, and redirect URI, and everything seems to be configured correctly. The issue seems to be happening consistently, so I’m wondering if there might be something I’m missing or if there’s a known issue with the API. I also check this: https://api-discuss.freeagent.com/t/apis-authentication-issuesnowflake But I have not found any solution. Could anyone guide me about this?

Has anyone encountered a similar problem or have any tips on how to troubleshoot this? Any advice or guidance would be greatly appreciated.

Thanks in advance for your help!

Respected community member! :smiling_face_with_three_hearts:

My application uses a refresh_token which is gathered just the once, and then used to fetch the access_token on a regular basis.

Only the refresh_token requires the “callback” URL to function. Getting access_tokens is simpler.

Are you writing an interactive application that requires the full Oauth flow and redirection? If not, you can fetch the refresh token using Postman, save it in your application and then your application can fetch access_tokens without the redirection flow.