we have Grafana embedded in our application and would like to forward to external pages from the Grafana panels to have a smooth user flow.
I know that there is already a feature to reuse the Grafana token to authenticate your datasource plugin, but is it also possible to forward this somehow from a panel plugin?
What would be the best approach to have a redirect with authentication to an external page within the Grafana dashboard?
That’s a tricky one, I think. If you’re using the standard Grafana auth configuration, then each user will be issued with a session cookie. This is used to authenticate requests to the Grafana back-end.
You can in principle use that cookie with another back-end also, but it’s not super-elegant. Basically:
- Ensure that the cookie’s scope covers the (sub-)domain where the other back-end is hosted, so that the browser will include that cookie with relevant requests
- Program your other back-end to make a “side request” to the Grafana API (e.g. the “user” endpoint) to confirm the validity of the cookie and the identity of the requester, and proceed with handling the request.
It’s possible that your auth is set up differently (e.g. you’re using OAuth) but the above I think is reflective of the default.