How to use credentials in HTTP request URL?

Describe the problem/error/question

I can get data from my server using a GET HTTP Request with a this URL:

https://www.mydomain.com/otobo/nph-genericinterface.pl/Webservice/PowerBI/TicketSearch?UserLogin=MyUsername&Password=MyPassword

I want to replace the MyUsername and MyPassword with credentials as I can then re-use them and they will be encrypted. I’ve been searching for a solution but just can’t find one that works (or maybe I just don’t understand them).

I’ve tried different kinds of authentication like Basic Auth, Header Auth and Custom Auth but none got me closer to a solution.

Has anyone solved this problem before or know a solution?

Information on your n8n setup

  • n8n version: 1.113.3
  • Database (default: SQLite): postgres
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 24.04

To securely store and reuse your username and password in n8n for your HTTP Request, you should use the Query Auth credential type. This is designed for cases where authentication is passed as a single key/value query parameter. However, since your API requires both UserLogin and Password as query parameters, you need to use Custom Auth instead, as Query Auth only supports a single parameter.

Here’s how you can set this up:

  1. Open your HTTP Request node.

  2. In the Authentication section, select Generic Credential Type.

  3. For Generic Auth Type, choose Custom Auth.

  4. Create a new credential. In the credential JSON, enter:

    {
      "qs": {
        "UserLogin": "your-username",
        "Password": "your-password"
      }
    }
    
    

    Replace "your-username" and "your-password" with the credential variables (these will be encrypted and reusable).

  5. In your HTTP Request node, use the URL without the credentials:

    https://www.mydomain.com/otobo/nph-genericinterface.pl/Webservice/PowerBI/TicketSearch
    
    

    The credentials will be automatically appended as query parameters by n8n.

Why not Basic or Header Auth?
Your API expects the credentials as query parameters, not as HTTP headers or in the basic auth format. That’s why Basic Auth and Header Auth do not work for your use case.

Reference:
This approach is supported and described in the n8n documentation for Custom Auth, which allows you to pass multiple query parameters for authentication.

If you follow these steps, your credentials will be encrypted, reusable, and not hardcoded in your workflow URLs.

P.S answer from docs.n8n chat :slight_smile: , since you can put credentials directly in the url(but is not safe).

1 Like

You’re a star! Work right away. Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.