Authentication¶
The Micromegas Grafana plugin supports two authentication methods.
Authentication Methods¶
API Keys¶
Simple authentication using a static API key.
- Best for: Development, small deployments, quick start
OAuth 2.0 Client Credentials¶
Enterprise authentication via identity provider (Google, Auth0, Azure AD, Okta).
- Best for: Production, enterprise deployments
API Key Authentication¶
flight-sql accepts keys from the analytics_api_keys table — the single key
source; authentication does not require OIDC. See
API Keys for the full reference, including
analytics-web-srv's HTTP routes for minting DB-backed keys (flight-sql
itself mints nothing over HTTP).
Quick Setup (DB-backed key)¶
- Mint a key via
POST /api/analytics-api-keysonanalytics-web-srv(or its Admin → Analytics API Keys page) — see API Keys. - Configure Grafana datasource:
- Auth Type: token
- Token: the minted
mmk_...key - Save & Test
OAuth 2.0 Client Credentials¶
Quick Setup¶
- Create service account in your identity provider:
- Google: Service account with JSON key
- Auth0: Machine-to-Machine application
- Azure AD: App registration with client secret
-
Okta: Service app
-
Configure server with OIDC settings (see Admin Guide)
-
Configure Grafana datasource:
- Auth Type: oauth2-client-credentials
- OIDC Issuer: Your provider URL
- Client ID: From step 1
- Client Secret: From step 1
- Audience: (Auth0/Azure AD only)
- Enable User Attribution: On (default) or Off
- Save & Test
Privacy Settings¶
Enable User Attribution controls whether user information is sent with queries:
- Enabled (default): Grafana username and email are logged on the server for audit purposes
- Disabled: Only the service account identity is logged
User attribution provides an audit trail showing which Grafana user ran which queries. This is separate from authentication (the service account authenticates the connection).
Provider URLs¶
| Provider | Issuer URL |
|---|---|
https://accounts.google.com |
|
| Auth0 | https://YOUR-TENANT.auth0.com |
| Azure AD | https://login.microsoftonline.com/TENANT-ID/v2.0 |
| Okta | https://YOUR-DOMAIN.okta.com |
Example: Auth0¶
Create a Machine-to-Machine application in Auth0:
- Go to Applications → Create Application
- Choose "Machine to Machine Applications"
- Select your API or create a new API identifier
- Copy the Client ID and Client Secret
Grafana Configuration:
Auth Type: oauth2-client-credentials
OIDC Issuer: https://YOUR-TENANT.auth0.com
Client ID: (from Auth0 application)
Client Secret: (from Auth0 application)
Audience: https://your-api-identifier (your API identifier from Auth0)
Example: Google Cloud¶
# Create service account
gcloud iam service-accounts create grafana-prod \
--display-name="Grafana Micromegas Datasource"
# Create key
gcloud iam service-accounts keys create credentials.json \
--iam-account=grafana-prod@PROJECT.iam.gserviceaccount.com
Grafana Configuration:
Auth Type: oauth2-client-credentials
OIDC Issuer: https://accounts.google.com
Client ID: grafana-prod@PROJECT.iam.gserviceaccount.com
Client Secret: (from credentials.json)
Testing¶
Click Save & Test to verify connection and authentication.