Request HTTP cannot path the Cookie Authentification

Hello,

Here is my code :

const result = await getBackendSrv().datasourceRequest({
            method: "POST",
            url: "URL",
            headers: {
                "Content-Type": "application/json; charset=UTF-8",
                Credential: "include",
                Cookie: {
                    name: "value",
                    Set: "value",
                    httpOnly: true,
                    origin: 'http://grafana.staged-by-discourse.com',
                }
                
            },
            data: JSON.stringify(testjsonobj.valueOf())
        })
        return result;

With this request I have the following error :

"Object reference not set to an instance of an object."

And with all my test i conclude that this is because the cookie set doesn’t work so I can’t log to my API.

Did anyone have an idea for this problem ?

Nicolas

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