<a id="grafana"></a>

# Grafana

<a id="backend-class"></a>

## Backend class

For Django, add this class path to `AUTHENTICATION_BACKENDS`. For other
integrations, use the same class path in the framework-specific backend
setting.

| Backend name   | Class path                                   |
|----------------|----------------------------------------------|
| `grafana`      | `social_core.backends.grafana.GrafanaOAuth2` |

Grafana works similar to Facebook (OAuth).

- On your project settings, you should add Grafana on your `AUTHENTICATION_BACKENDS`:
  ```default
  AUTHENTICATION_BACKENDS = (
      ...
      'social_core.backends.grafana.GrafanaOAuth2',
  )
  ```
- Register a new application at Grafana Cloud Portal in grafana.com by doing
  My Account → SECURITY → OAuth Clients → Add OAuth Client Application.
  Set any name and in URL just the domain, without any path.
- Copy client_id and client_secret and add these values in your project settings file.

The `client_id` should be added on `SOCIAL_AUTH_GRAFANA_KEY` and the `client_secret` should be
added on `SOCIAL_AUTH_GRAFANA_SECRET`:

```default
SOCIAL_AUTH_GRAFANA_KEY = 'a1b2c3d4'
SOCIAL_AUTH_GRAFANA_SECRET = 'e5f6g7h8i9'
```

- The default scope is ``['profile', 'email']`` but it’s possible to define it in settings with:
  ```default
  SOCIAL_AUTH_GRAFANA_SCOPE = [...]
  ```
