Grafana OAuth setup for a webapp for users

I’m developing an external application that needs to integrate with any Grafana Cloud instance. Specifically, I’m trying to set up OAuth to allow users to sign into their Grafana Cloud instance through my application, and then retrieve data such as their instance’s logs and other metrics. I’m not trying to setup just an OAuth to sign into their account.

However, I’m encountering issues with this setup.

My requirements are:

  1. Enable users to authenticate with their Grafana Cloud credentials through my external application.
  2. Once authenticated, allow my application to access user-specific data like logs and metrics from their Grafana instance

For example, after they click something like “sign into Grafana,” they can sign in, and I can grab the auth details for, say, Grafana API use. I can then use that to get their logs and whatever else in Grafana Cloud. The current link I have (which is probably wrong) is like this:

https://[redacted].grafana.net/login/generic_oauth?client_id=[redacted]&redirect_uri=[redacted]&response_type=code&scope=openid%20profile%20email

9:45 PM

I’m unsure how to approach this integration. The documentation I’ve found primarily focuses on setting up OAuth clients for a single Grafana Cloud instance so someone with like a Google account can now sign into their Grafana instance (Configure OAuth 2.0 | Grafana Cloud documentation). Not for an external application to access a user’s instance and their details.

Questions:

  1. Is OAuth the correct approach for this integration, or should I be using a different method?
  2. If OAuth is appropriate, what specific steps do I need to take to enable and configure it for my use case? Is there any documentation on it?

I would greatly appreciate your guidance on how to properly set up this integration between my external application and any Grafana Cloud instance.

So your application must be OAuth server, which will be configured in Grafana’s OAuth config.

How can you do that?

llike maybe set up a service account within their grafana cloud instance after oauth? then use the service account token to grab info. i don’t think I understand your first point though. could you clarify what you mean