Skip to content

docs: correct cookie forwarding behavior for app plugins - #2889

Open
gluefactory wants to merge 1 commit into
grafana:mainfrom
gluefactory:docs/app-plugin-cookies-2874
Open

gluefactory wants to merge 1 commit into
grafana:mainfrom
gluefactory:docs/app-plugin-cookies-2874

Conversation

@gluefactory

@gluefactory gluefactory commented Sep 17, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

The "Work with cookies" section of the app plugin authentication guide states that an app plugin can read cookies forwarded by Grafana, and shows a snippet looping over req.Cookies(). That hasn't been true since grafana/grafana#88663 removed cookie forwarding for app plugins.

In cookies_middleware.go, the allowed-cookie list is only populated inside if pCtx.DataSourceInstanceSettings != nil, so for an app it stays empty and ClearCookieHeader strips the Cookie header from QueryData, CallResource, and CheckHealth requests. Following the current docs gives you an empty slice with no error or warning.

This replaces the section with the actual behavior, plus pointers to the supported alternatives for identifying the calling user and for calling the Grafana API.

Which issue(s) this PR fixes:

Fixes #2874

Notes:

The issue's suggested text links to app-with-service-account and app-with-rbac in grafana-plugin-examples; both 404 (that repo currently has app-basic and app-with-backend), so I've linked the in-repo guides use-a-service-account.md and implement-rbac-in-app-plugins.md instead.

Verified backend.PluginConfigFromContext and the backend.User fields (Login, Name, Email, Role) against grafana-plugin-sdk-go main, and X-Grafana-Id against this repo's RBAC guide. npm run docs:build passes, which with onBrokenLinks/onBrokenAnchors set to throw confirms every link in the new text resolves.

🤖 Generated with Claude Code

Grafana stopped forwarding cookies to app plugin backends in #88663, but
the app plugin authentication guide still told readers their app could
read forwarded cookies and showed a snippet looping over req.Cookies().
The allow-list is only populated from data source settings, so an app
always receives an empty Cookie header.

Replace the section with the actual behavior and point readers at the
supported alternatives for identifying the calling user and for calling
the Grafana API.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@cla-assistant

cla-assistant Bot commented Sep 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@gluefactory
gluefactory marked this pull request as ready for review September 17, 2026 17:36
@gluefactory
gluefactory requested a review from a team as a code owner September 17, 2026 17:36
@gluefactory
gluefactory requested review from ashharrison90 and eledobleefe and removed request for a team September 17, 2026 17:36
@grafana-catalog-project-bot grafana-catalog-project-bot Bot moved this from 📬 Triage to 🔬 In review in Grafana Catalog Team Sep 17, 2026
@tolzhabayev tolzhabayev added the type/docs Changes only affect the documentation label Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/docs Changes only affect the documentation

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

Docs: app plugin "Work with cookies" section documents behavior removed

2 participants