Skip to content

docs: add a complete auth example app and sharpen authentication-vs-authorization framing - #7010

Merged
masenf merged 7 commits into
mainfrom
claude/reflex-enterprise-auth-docs-32p7p1
Sep 1, 2026
Merged

docs: add a complete auth example app and sharpen authentication-vs-authorization framing#7010
masenf merged 7 commits into
mainfrom
claude/reflex-enterprise-auth-docs-32p7p1

Conversation

@FarhanAliRaza

@FarhanAliRaza FarhanAliRaza commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed?

Type of change

  • This change requires a documentation update

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully ran tests with your changes locally?

Docs-only change (ENG-10954, follow-up to the initial auth docs). The builder agent retrieves these pages during memory retrieval, so this is the knowledge layer behind generating correct rxe.AuthPlugin code.

  • New page docs/enterprise/auth/example-app.md — one small, complete app (public landing page, protected dashboard, admin-only action) showing the whole pattern in ~100 lines: plugin config with placeholder OIDC_* vars, checks in one authz.py module, state with auth=False opt-outs and an auth=is_admin action, rxe.App(), and a run walkthrough. Ends with the best-practice rules and the failure modes (rx.App() vs rxe.App(), blank-when-logged-out, redirect_uri_mismatch, the deprecated register_auth_endpoints).
  • Authentication vs authorization framing — the page opens with the two questions ("who is this user?" is the plugin's job; "what may this user do?" is auth=) and a decision table for picking the auth= value; the overview gains a matching paragraph.
  • Sidebar — the page is added to the enterprise auth section after Secure by Default; the overview and secure-by-default pages link to it.

Docs app tests pass locally (tests/test_sidebar.py, test_doc_links.py, test_routes.py, test_urls.py, test_frontmatter_meta.py, test_doc_description.py, test_breadcrumbs.py).

Linear: ENG-10954


Generated by Claude Code

Review in cubic

@FarhanAliRaza
FarhanAliRaza requested review from a team and Alek99 as code owners August 31, 2026 20:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T20:14:12.857505Z 9c26f49 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codspeed-hq

codspeed-hq Bot commented Aug 31, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 32 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing claude/reflex-enterprise-auth-docs-32p7p1 (90d14b9) with main (3573364)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a complete enterprise authentication example and links it from the auth overview, secure-by-default guide, and sidebar.

  • Demonstrates public, authenticated, and administrator-only surfaces.
  • Adds a shared Team Notes board, authorization checks, role guidance, and common troubleshooting advice.

Confidence Score: 3/5

The PR is not yet safe to merge because the shared-board example grants unrelated authenticated users access to the same mutable notes state.

Every dashboard session links to the identical shared-state token without deriving or authorizing a team identifier, allowing cross-team reads and mutations in deployments serving more than one organization.

Files Needing Attention: docs/enterprise/auth/example-app.md

Security Review

The shared-board fix links every authenticated session to one constant shared-state token, so a deployed multi-team app would expose the same notes to unrelated authenticated users and allow cross-team modification.

Important Files Changed

Filename Overview
docs/enterprise/auth/example-app.md Adds the complete auth example, but its constant shared-state token does not isolate notes between teams or organizations.
docs/app/reflex_docs/templates/docpage/sidebar/sidebar_items/enterprise.py Adds the new example page to the enterprise authentication sidebar.
docs/enterprise/auth/overview.md Clarifies authentication versus authorization and links to the complete example.
docs/enterprise/auth/secure-by-default.md Adds a related-page link to the complete example.

Reviews (8): Last reviewed commit: "docs: cover app-owned roles and where th..." | Re-trigger Greptile

Comment thread docs/enterprise/auth/example-app.md
Comment thread docs/enterprise/auth/example-app.md
@FarhanAliRaza
FarhanAliRaza force-pushed the claude/reflex-enterprise-auth-docs-32p7p1 branch from 9c26f49 to e55401c Compare August 31, 2026 20:13
Add docs/enterprise/auth/example-app.md: one small, complete app (public
landing page, protected dashboard, admin-only action) showing the whole
rxe.AuthPlugin pattern — authentication owned by the plugin, authorization
expressed with auth= checks — plus the common failure modes (rx.App() vs
rxe.App(), blank-when-logged-out, redirect_uri_mismatch, the deprecated
register_auth_endpoints).

Link it from the overview and secure-by-default pages and add it to the
enterprise sidebar after Secure by Default.
@FarhanAliRaza
FarhanAliRaza force-pushed the claude/reflex-enterprise-auth-docs-32p7p1 branch from e55401c to 6b6dc33 Compare August 31, 2026 20:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c26f49272

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/enterprise/auth/example-app.md Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread docs/enterprise/auth/example-app.md
Comment thread docs/enterprise/auth/example-app.md Outdated
FarhanAliRaza and others added 2 commits August 31, 2026 20:19
…ent state explicit

The landing page now renders dark_mode (button label, page colors), so the
public field and handler have a visible effect, and the example states that
Reflex state is per-client — each user sees their own notes — instead of
presenting itself as a shared notepad.
Comment thread docs/enterprise/auth/example-app.md Outdated
Comment thread docs/enterprise/auth/example-app.md Outdated

@masenf masenf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a few comments. overall i think the example is good. but we want to make sure we're not demonstrating less-than-desirable style

…ark mode

Per review: NotesState is now an rx.SharedState linked to one team token
from the dashboard's on_load (behind the page guard), so signed-in users
share one live board; the landing page's public surface is a dismissible
promo banner instead of a hand-rolled dark-mode toggle that shadowed the
framework's color-mode support.

@masenf masenf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few more things, but i like this example modifications a lot more!

Comment thread docs/enterprise/auth/example-app.md Outdated
Comment thread docs/enterprise/auth/example-app.md Outdated
The linked-token underscore rule lives in the Shared State doc this page
links to, and the SharedState version note is moot when the auth plugin
already requires a newer reflex.
Some providers serialize the groups claim as one string, and Python's 'in'
on a string is a substring test, so both example checks now require a list
before testing membership; a short note explains the guard.
masenf
masenf previously approved these changes Sep 1, 2026
The example only showed a role the identity provider already manages, which
is the cheapest check there is but also the case an app rarely has. Roles
like author/editor/reviewer are the app's own, and promoting someone from
inside the app is impossible against an IdP -- there is no write-back. With
no guidance for that, the natural next step is a check that opens a database
session, and a check runs on every gated event.

Adds the variant: load the member's row into a state at sign-in and have an
async check read it through get_state, keyed on sub (or provider_name+sub,
since sub is unique only per issuer) rather than the optional email claim.

Also states where the claims actually come from. extra_scopes asks for a
scope, but a check reads whatever the provider's userinfo endpoint returns --
_get_userinfo prefers _fetch_userinfo and uses its response verbatim, falling
back to ID token claims only when the issuer advertises no userinfo endpoint.
A groups claim mapped only into the ID token therefore never reaches the
check, which returns False for everyone with nothing in the logs to explain
it. The 30-minute claim cache is noted beside it, since it is the same
surprise arriving later.
Comment thread docs/enterprise/auth/example-app.md
@FarhanAliRaza
FarhanAliRaza requested a review from masenf September 1, 2026 15:49
@masenf
masenf merged commit d554431 into main Sep 1, 2026
135 of 136 checks passed
@masenf
masenf deleted the claude/reflex-enterprise-auth-docs-32p7p1 branch September 1, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants