Passing roles to grafana iframe from parent

We are trying to integrate grafana in our UX. We have credentials to login in into our UX. Grafana is shown inside an iframe. The behavior we want to achieve is if someone logins with 'admin’role, it should map to ‘admin’ role of grafana, when he clicks on the grafana tab on our UX. Similary, if the role is ‘guest’, it should map to ‘viewer-only’ role in grafana. Was thinking of using JWT Bearer token based Oauth to fix this. The flow will be:

  1. User logins and get the jwt token as cookie from our backend, which has the grafana-role also embedded inside it.
  2. User clicks on the grafana tab within our UX, the above cookie hits the grafana server.
  3. Grafana server interprets the cookie and maps to appropriate role in grafana. For e.g., admin gets the admin view, guest gets the viewer-only view, etc.

Is there an already available plugin for this?
Can someone point me to some documentation as to how to write a plugin??
Appreciate your help.

This is a not use case we are supporting right now. A few other people have tried this:

Docs for developing plugins.

Curious to know who did you solve this? We are also thinking to embed Grafana but need that level of permissions for users.

Looking forward to hear from you. I appreciate it.

Hi amitchandak

Were you able to solve this? We are also trying to embed Grafana in our application. The authentication will be done using the token, skipping the login page. So when user clicks on the link the authentication is done in the backend using flask and user is able to view the Grafana dashboards in an iframe without having to log in by explicitly providing the credentials.

Looking forward to hear from you.