Grafana auto login from Angular button click

Hi ,

I am looking for a solution to enable auto login to grafana.
Requirement is to create a button in our web application(angular 8). when user will click on button,it will open a new tab with auto login grafana dashboard for particular user.

please suggest me a way to do.

Hi @sugandha18,

Welcome to the :grafana: community support forums !!

One additional question, are those users are like guest users OR real users defined inside Grafana with various roles?

1 Like

@usman.ahmad users are going to real. we decided to call Grafana dashboard API (http://grafana.staged-by-discourse.com/api/admin/users) to create different users account in Grafana at the time when user will login to our web application.

Hi @sugandha18

Thanks for the reply. I found some similar posts which might be helpful for you e.g.

1- Automatic login to grafana from web application

2- Automatic Authentication using Grafana API - Stack Overflow (seems a bit different but the concept/idea is the same).

3- Automatic login by token url · Issue #3752 · grafana/grafana · GitHub (some good comments there with workarounds, ideas, and solutions).

And for knowing the configuration, please read the documentation:

I hope this helps.

Hi @usman.ahmad , Thanks for the information.
one more question please.
Is there any API which help us to return session key of Grafana session if we pass our username/password?

Hey @sugandha18,

hmm, I think that is possible using Authentication HTTP API as it does says;

you can authenticate via an API Token or via a Session cookie (acquired using regular login or OAuth).

Here is the link:

I hope this helps.

Hi @usman.ahmad thank you for your response.
this link is not specifying if we can get session key from any authentication API.I am looking for some solution where I can give Grafana username and password and api should have return me grafana session cookie.

Please assist.

Please correct incase if I miss any details so that I can get more details.

So the scenario is like this;

Your user’s login to the Angular App and with a click of a button, they can login into grafana (as I understood earlier, those users are real users in the grafana database).

Once the user login, you want to know if you find the logged-in users via API?

is this the correct scenario?

I was able to manage my use case with auth proxy. thanks for your help.
also can you please help me to find a solution for Manage Datasource user from API this as well.

Thank you in advance @usman.ahmad.

Hi @sugandha18,

Happy to hear that you find a solution.

As Grafana Community we will be happy if you can share your solution steps with us so that the Community members can learn from your post (who have the same issues) and provide feedback if they feel as an improvement.

@sugandha18, could you show some of your code, please? I ma trying to open graphing dashboard with a auto-login. None of above resources helped. Thank you