Generic oauth - Send Authorization header during opentsdb queries

Hi everyone,

I’m able to login to Grafana with generic_oauth (keycloak).
My datasource is opentsdb which is also protected by keycloack.
Due to there isn’t Authorization header in requests, i’ve a 401 Unauthorized response for opentsdb query.
I’ve check “With credentials” option for the datasource, but nothing changes.

Do you know if it’s possible to use same authentication for grafana and datasources?
Thank you in advance for your responses.

Grafana 5
Opetnsdb 2.3

Hi everyone,

I was wondering if there was any further information on this topic. I have also setup up a generic oauth authentication with our internal oauth server (works well). I am now developing a data source (using the simple json datasource as example) that connects to our API and get the data. However, I do not understand how I can set the Authorization header of each api query with the token we get during the grafana authentication process. Thus my datasource fails because it requires a oauth token.

I tried to tick the ‘with credential’ but it did not get any further.

Thank you for your help!

I am running Grafana 5 on Docker, access over ssl.

In theory:
Save a token to the cookie and add that cookie name to “Whitelisted Cookies” in the datasource configuration. Then your datasource backend should read token from the cookie.
It’s very hackish. For any proper implementation, some kind of Angular HttpInterceptor should be implemented and configured per datasource.

And still you may have a problem with expired tokens/refresh tokens etc. There is no native support for Oauth in the Grafana datasource for now.

Thank you @jangaraj, I will give it a try.

This is exactly, what I need but in a more generic way:

Should this be treated as an important feature request?