Infinity Plugin - HTTP API Authentication via URL Parameters "user" AND "password"

Hello everyone,

my Boss told me to get this working by any means possible. I do have some Experience in using REST API but never with Grafana.
My Task is to build a Dashboard / Visualization to Compare two Values. In Grafana Terms: I got two Datasources. One is working fine and I can view my needed Data but my Second Datasource does not.

Hope someone can answer me with this.

Datasource needs to be a Infinity Datasource for HTTP API Call. It’s a German Application with only German API Doc. Could provide it if helpful, but as this is a English Community I won’t attach it for now.

This API needs to Login via {{baseURL}}/Home/LoginAPI?user=username&password=password
After that the relevant Request can be made with another call, e.g. {{baseURL}}/Persons/GetDailyBalance?personID=11&date=2025/07/08&adaptPeriodToday=true&monthOverview=true

There is no possibility to do Login and Request in one Query. Program does not support API Tokens / Bearer / whatever-else-auth-mode, it needs to be via exact this way. Already contacted Support about this Issue.

In e.g. Postman or Nighingale REST API Client all Querys work just fine, but I don’t find a way to get this working in Grafana.

Grafana Version: Version 12.0.1+security-01
Running on Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-60-generic x86_64)

The Grafana Infinity Plugin does not support embedding credentials in the query string directly, leading to authentication issues and insecure access patterns.
You can solve this problem suing follow the given steps:
Use External Proxy
Logging in.
Saving the session.
Forwarding the request to the actual data endpoint.
Returning the result in JSON or Table format Grafana/Infinity can use.

Step : 1 You can use Node.js Proxy API to Handle Login then hit other api and Fetch data then use it in Grafana/Infinity
Step :2. Setup the node js server like

 const express = require('express');
const axios = require('axios');
const cookieJar = require('tough-cookie').CookieJar;
const { wrapper } = require('axios-cookiejar-support');

const app = express(); 
const PORT = 3000;
const jar = new cookieJar();
const client = wrapper(axios.create({ jar, withCredentials: true }));

// Helper: Login and return cookie session
async function loginToAPI() {
    const loginURL = `${BASE_URL}/Home/LoginAPI?user=${USERNAME}&password=${PASSWORD}`;
    const res = await client.get(loginURL);
    if (res.status !== 200) {
        throw new Error('Login failed');
    }
    return true;
}

// Route Grafana will query
app.get('/balance', async (req, res) => {
    try {
        const { personID, date } = req.query;
        if (!personID || !date) {
            return res.status(400).json({ error: 'Missing personID or date' });
        }

        // Ensure we're logged in
        await loginToAPI();

        // Request the data
        const balanceURL = `${BASE_URL}/Persons/GetDailyBalance?personID=${personID}&date=${date}&adaptPeriodToday=true&monthOverview=true`;
        const response = await client.get(balanceURL);

        res.json(response.data);
    } catch (err) {
        console.error(err);
        res.status(500).json({ error: 'Internal server error', details: err.message });
    }
});

app.listen(PORT, () => {
    console.log(`Proxy server running at http://localhost:${PORT}`);
});

Step : 4 use output in Infinity