Authenticate Alert Rule that use Data Source with Forward OAuth

What Grafana version and what operating system are you using?

  • 12.3

What are you trying to achieve?

  • I am trying to authenticate my alert rule using a data source that uses forward OAuth as its authentication method. When the alert is evaluated, it receives a 401, because there isn’t a way to pass authentication when configuring the alert. The endpoint that the data source queries (Mimir, Loki, Tempo) requires a Bearer token, but the alerting engine doesn’t forward it.

How are you trying to achieve it?

  • I don`t know if it is possible to achieve it.
1 Like

I got the same issue, did you solve it?

This is a known issue. See Alerting: prevent users from creating rules that query data sources that require credentials forwarded from client · Issue #89180 · grafana/grafana · GitHub

The issue is currently marked as stale, so feel free to open a new one to bring visibility and share your use case.

As a workaround, if Forward OAuth is not strictly required for querying the data source, you can create a second data source pointing to the same backend but using a different auth method (for example, Basic Auth) and use that data source for alert rules instead.