Skip to content

docs: add Anonymous Sessions guidance for express-oauth2-jwt-bearer#250

Open
cschetan77 wants to merge 1 commit into
mainfrom
feat/anonymous-sessions-docs
Open

docs: add Anonymous Sessions guidance for express-oauth2-jwt-bearer#250
cschetan77 wants to merge 1 commit into
mainfrom
feat/anonymous-sessions-docs

Conversation

@cschetan77

Copy link
Copy Markdown

Summary

Auth0 Anonymous Sessions issues standard JWT Bearer tokens to unauthenticated users. These tokens pass through express-oauth2-jwt-bearer validation unchanged — the only distinguishing characteristic is that sub starts with anon@.

This PR documents the three patterns developers need to handle anonymous callers using primitives already available in the SDK:

  • Block all anonymous callers globally — via the validators.sub option on auth()
  • Block anonymous callers on specific routes — via claimCheck()
  • Accept anonymous callers and branch in the handler — via req.auth.payload.sub

Changes

  • EXAMPLES.md — new Anonymous Sessions section with TOC entry and the three code patterns
  • README.md — brief callout under the SDK configuration section linking to the examples

Documents how to handle Auth0 Anonymous Sessions tokens — which carry a
`sub` claim prefixed with `anon@` — using the existing `validators`,
`claimCheck`, and `req.auth.payload` primitives.
@cschetan77
cschetan77 requested a review from a team as a code owner July 22, 2026 15:02
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.

1 participant