# N8n Cloud OAuth2 – FreeAgent authorisation succeeds but token exchange fails (invalid\_grant / HTTP Basic: Access denied)

**URL:** <https://api-discuss.freeagent.com/t/n8n-cloud-oauth2-freeagent-authorisation-succeeds-but-token-exchange-fails-invalid-grant-http-basic-access-denied/6845>\
**Category:** Authentication\
**Created:** [21 October 2026 16:53 UTC](https://api-discuss.freeagent.com/t/n8n-cloud-oauth2-freeagent-authorisation-succeeds-but-token-exchange-fails-invalid-grant-http-basic-access-denied/6845 "2026-10-21T16:53:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zlet](https://api-discuss.freeagent.com/letter_avatar_proxy/v4/letter/z/58f4c7/32.png) [@zlet](https://api-discuss.freeagent.com/u/zlet)\
**Post date:** [21 October 2026 16:53 UTC](https://api-discuss.freeagent.com/t/n8n-cloud-oauth2-freeagent-authorisation-succeeds-but-token-exchange-fails-invalid-grant-http-basic-access-denied/6845/1 "2026-10-21T16:53:59Z")

</div>

We are attempting to connect FreeAgent to n8n Cloud for a read-only property management and rent-monitoring workflow.

After numerous unsuccessful attempts, FreeAgent’s support team has referred us to this forum (support ticket #1338939).

**Application details**

- Application name: ZLET Rent Monitoring

- Application ID: 13698

- Client ID: aoxJWDaD3fLDneQvDnQ5Dg

- Environment: Production

- Integration platform: n8n Cloud

- OAuth grant type: Authorization Code

**OAuth configuration**

Authorization URL:  
`https://api.freeagent.com/v2/approve_app`

Token URL:  
`https://api.freeagent.com/v2/token_endpoint`

Redirect URI:  
`https://oauth.n8n.cloud/oauth2/callback`

Scope: Blank

**Problem**

The FreeAgent login and application approval stages work successfully.

The application is also visible under Approved Applications within our FreeAgent account.

However, when n8n attempts to exchange the authorisation code for access and refresh tokens, the connection fails.

We have encountered two errors:

1. With Header authentication, n8n reports:

2. With Body authentication, n8n reports:

**Troubleshooting already completed**

- Confirmed the Client ID matches the FreeAgent Developer Dashboard.

- Confirmed the redirect URI matches exactly.

- Decoded the live authorisation URL and verified that it contains the correct redirect URI.

- Generated a new OAuth Client Secret on 21 October 2026 at 09:41:39 UTC.

- Re-entered the credentials in n8n.

- Tested both Header and Body authentication.

- Verified the application is approved in the FreeAgent company account.

None of these steps has produced a successful n8n connection.

**Request**

Could a FreeAgent engineer inspect the token endpoint logs for application 13698 on 21 October 2026 and identify why the token exchange is failing?

In particular:

1. Is the authorisation code being rejected because the redirect URI is absent or different in the token exchange?

2. Are the client credentials being rejected, or is the authorisation code invalid, expired or already consumed?

3. Is there a known compatibility issue with n8n Cloud’s OAuth2 API credential?

4. Can you confirm the exact supported configuration for n8n, including the token request’s authentication and encoding requirements?

The token exchange is handled internally by n8n, so we have not yet captured the raw outgoing POST request. The exact request timestamps and originating IP address are also not currently available.

We would appreciate a specific technical diagnosis rather than repeating configuration changes already tested.

We can supply additional sanitised diagnostic information as required. We will not post Client Secrets, authorisation codes or access tokens publicly.

Thank you.

---

<div class="post-metadata">

**Author:** ![Mralaura](https://api-discuss.freeagent.com/user_avatar/api-discuss.freeagent.com/mralaura/32/1303_2.png) [@Mralaura](https://api-discuss.freeagent.com/u/Mralaura)\
**Post date:** [29 October 2026 11:32 UTC](https://api-discuss.freeagent.com/t/n8n-cloud-oauth2-freeagent-authorisation-succeeds-but-token-exchange-fails-invalid-grant-http-basic-access-denied/6845/2 "2026-10-29T11:32:21Z")

</div>

One thing I’d be careful about here is treating those two errors as the same problem.

The HTTP Basic error suggests the client authentication might be failing before the authorization code is even checked. The `invalid_grant` response with body authentication could be a separate issue, especially if the code has already been used or expired during earlier attempts.

I’d try a fresh authorization flow for each test rather than switching authentication methods with the same code.

If that still fails, the most useful thing for FreeAgent’s team would probably be the exact token request format (with secrets and codes redacted), including how n8n sends `client_id`, `client_secret`, `redirect_uri` and `grant_type`.

Without seeing that request, it’s pretty hard to tell whether this is an n8n compatibility issue or something being rejected by FreeAgent.

---

<div class="post-metadata">

**Author:** ![Jamie\_McGlone](https://api-discuss.freeagent.com/user_avatar/api-discuss.freeagent.com/jamie_mcglone/32/1273_2.png) [@Jamie\_McGlone](https://api-discuss.freeagent.com/u/Jamie_McGlone)\
**Post date:** [29 October 2026 14:20 UTC](https://api-discuss.freeagent.com/t/n8n-cloud-oauth2-freeagent-authorisation-succeeds-but-token-exchange-fails-invalid-grant-http-basic-access-denied/6845/3 "2026-10-29T14:20:17Z")

</div>

Hi there 👋,

Jamie from FreeAgent here! Thanks for the detailed write-up and for listing everything you’d already tried!

Firstly, from our logs it looks like your app completed the token exchange successfully on October 26th. Since then it has refreshed its tokens every day and has been successfully pulling data from the API. Could you confirm that your n8n workflow is now working as expected on your side?

From checking our logs, it looks like your requests on October 21st were using an invalid client secret.

If I’ve misunderstood, or the problem comes back, please let me know the approximate time (in UTC) of a failed attempt and we’ll take another look. 🙂

Kind regards,

Jamie
