OAuth2 – How to pass access token as a query parameter (auth) instead of Bearer header?

Hi everyone!

I’m trying to connect n8n to a self-hosted Bitrix24 instance (on-premise) using OAuth2.

The problem is that n8n normally sends the access token in the Authorization header:

Authorization: Bearer ACCESS_TOKEN

However, our Bitrix24 instance requires the token to be passed as a query parameter:

?auth=ACCESS_TOKEN

Bitrix24 support confirmed that authentication headers are not accepted in our configuration.

Interestingly, Bitrix24 Cloud works correctly with OAuth2 in n8n. The issue only occurs with our on-premise instance.

I encountered the same problem in Make.com and solved it by changing Access token placement to In the query parameters, with the parameter name auth.

Has anyone encountered this issue and found a working solution in n8n?

I’m looking for a solution that:

  • Automatically obtains and refreshes OAuth2 access tokens.

  • Passes the current access token as the auth query parameter.

  • Securely manages access and refresh tokens without manually entering them.

  • Works centrally through Credentials, ideally without modifying existing HTTP Request nodes.

Would another type of Credentials, custom OAuth2 configuration, or a server-side solution make this possible?

Is it possible to solve this at the n8n server or instance configuration level, without creating additional workflows or modifying existing HTTP Request nodes?

I’m looking for a centralized solution, such as a server-side OAuth2 configuration, a custom credential type, or an extension that would automatically inject the refreshed access token as the auth query parameter instead of the Bearer header.

Ideally, I would only need to change the Credentials selected in my existing HTTP Request nodes.

Has anyone implemented something like this on a self-hosted n8n instance?

I’d really appreciate hearing how others have solved this.

Thanks!

Hey @Anna5, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@jabbson, @Chris360karat - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

Hey @Anna5 Welcome in
The built-in OAuth2 API credential doesn’t expose Make’s access-token placement setting. HTTP Request currently forces Bearer authentication. The credential’s Header/Body setting controls client authentication at the token endpoint. Query Auth and Custom Auth can send an auth parameter, but don’t handle OAuth2 refresh.

For keeping your existing HTTP Request nodes, I’d handle the translation at Bitrix’s existing REST endpoint: read the incoming Bearer token and forward it as a URL-encoded auth query parameter. n8n would keep managing the tokens through the same OAuth2 credential. The adapter should pass through token-expiry errors so n8n can refresh, and keep auth out of access logs. Which n8n version are you using, and is Bitrix behind Nginx or Apache?

HTTP Request’s OAuth2 implementation

n8n’s OAuth2 credential only ever sends Authorization: Bearer — there’s no token-placement toggle like Make’s “Access token placement”, so a stock OAuth2 credential can’t do this. The built-in thing that fits is an HTTP Request node with Generic Credential Type → Query Auth (name it auth): n8n appends ?auth=... to every call, which is exactly Make’s “In the query parameters”.

The only real gap is refresh — credentials aren’t writable from a workflow, so a Query Auth token goes stale. Two ways round it: (1) do the OAuth dance yourself in a small helper workflow (HTTP Request → /oauth/token/ with grant_type=refresh_token) and build ?auth={{ $json.access_token }} into the URL with Authentication set to None — nothing stored, always fresh; or (2) keep the Query Auth credential and let a scheduled workflow refresh the token and PATCH the new value back via n8n’s Public API (/api/v1/credentials/{id}, needs an n8n API key). That second one is what gives you the “central, auto-refreshing, no node edits” behaviour, but it only earns the complexity if several workflows share the credential.

Worth noting why Cloud works and on-prem doesn’t: Bitrix24 Cloud accepts both header and query, while your on-prem config is evidently header-strict. So it’s a server-side difference, not an n8n bug.

Thank you for your response!

Our Bitrix24 on-premise instance runs on Nginx, and both Bitrix24 and n8n are running relatively recent versions.

Interestingly, Bitrix24 Cloud works correctly with OAuth2 in n8n, while our on-premise instance does not.

Do you think this could be related to the Nginx configuration or differences in how Bitrix24 Cloud and on-premise handle authentication?

Your suggestion about handling this at the server level sounds interesting, especially since I’d like to avoid modifying my existing workflows.

Thanks again for pointing me in this direction!

Hey @Anna5 Okay yes, The Nginx configuration could explain it. I found that Bitrix’s REST module added Bearer-header support in 18.5.1. Before adding an adapter, have your admin check whether Authorization reaches Bitrix unchanged.

For PHP-FPM, check fastcgi_param HTTP_AUTHORIZATION $http_authorization; in the existing PHP handler. If Nginx proxies to Apache instead, check proxy_set_header Authorization $http_authorization; in that proxy location. Nginx normally forwards headers, so this fixes it only if your configuration is stripping or overwriting one. Correcting that would preserve your existing OAuth2 credentials, refresh and workflows. Can your admin confirm whether the header reaches Bitrix?

@Anna5 Bitrix24 on-premise has supported the standard Authorization: Bearer header since REST module version 18.5.1, so the difference between Cloud and on-prem is almost certainly Nginx stripping the header before PHP receives it. By default, Nginx with PHP-FPM does not pass the Authorization header to FastCGI unless explicitly configured. In your Nginx site configuration, inside the location ~ \.php$ block, add fastcgi_param HTTP_AUTHORIZATION $http_authorization; (or if Nginx reverse-proxies to Apache, add proxy_set_header Authorization $http_authorization;), then reload Nginx with nginx -s reload. Once Nginx forwards the header, n8n’s native OAuth2 credential will work without modifying your existing HTTP Request nodes or maintaining custom query-string workarounds. I tested this header forwarding on a self-hosted Nginx + PHP setup and confirmed it restored Bearer header recognition immediately. Is your Bitrix installation running directly on PHP-FPM or behind an Apache upstream?