SimpleJson datasource plugin - send user/pass in request

I want to use the SimpleJson datasource plugin but I want to have it send also a username and password, either the ones that the user logged into grafana with or better yet some that they can just input manually somewhere in the dashboard.
Is this possible somehow?

Just tested and it does not support the With Credentials option which would send cookies (which include the username) with the request. It would however be easy to add. I’m having a quick look at it now.

I have something working locally but not sure if it solves your problem. It enables the WithCredentials mode that will send three Grafana key-values in the cookie field in the request header: grafana_remember, grafana_sess, grafana_user

The headers will look something like this:

{ host: 'localhost:3333',
  connection: 'keep-alive',
  'content-length': '406',
  pragma: 'no-cache',
  'cache-control': 'no-cache',
  authorization: 'Basic dGVzdDp0ZXN0',
  origin: '',
  'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36',
  'content-type': 'application/json',
  accept: 'application/json, text/plain, */*',
  referer: '',
  'accept-encoding': 'gzip, deflate, br',
  'accept-language': 'en-US,en;q=0.8,sv;q=0.6',
  cookie: 'grafana_sess=e7a483157221c32f; grafana_user=admin; grafana_remember=8dd6585e887d1fdd5de7afc32d167b3647602b83896b2f0fe3b8ea6ff8c624a6b0' }

You have to use direct mode (direct means contacting the data source directly from the browser rather than proxying through the grafana server) to be able to pass cookies in the header. This makes the preflight check for CORS much stricter so you will probably have to change CORS settings in your backend service.

What do you think?

Branch with changes to SimpleJSON datasource here. Just have to test a little bit more.

Thanks @daniellee I will have a look and see if I can fit this to my solution.
This has been a great help!