Writing secure_json_data in grafana sqlite database

I have bound grafana to a rest API and it works pretty well.
However the authentication is through bearer token only, which expires everyday.

I do have a script that generates a new token everyday, however, I’m struggling to update the sqlite entry in the sqlite database grafana.db
I appears the headers are stored in the field


from table


this secure_json_data seems encrypted, but I don’t know how to correctly encrypt my new bearer. Any hint ?

Can you provision the dashboard every day using some scripting language that provides that token?

What is fhe api plugin you are usin?

I’m using JSON API plug in by Marcus Olsson.
I can actually get a new token through scripting language, my issue is how to automatically update the datasource with the updated token.

Like I said, I think I found where this information is stored in the grafana sqlite database, however as it is encrypted, I don’t know how to update the field with the expected encryption.

Dont mess with the db as it is not recommended and not documented.
Go the api route or provisioning route

I’d do that if I had any clue on how to daily update the custom http headers section in the data source:

Read the docos

1 Like

Alright, this ended up very useful.
I managed to specify the api token through provisionning.

Now I noticed grafana server had to be restarted for datasource.yaml modifications to be taken in account, is there any more elegant way to update my token daily without have to stop/start the server ?

Bummer. I would try datasource api update route then

1 Like