mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
<!-- Make sure you've read the CONTRIBUTING.md guidelines: https://github.com/stack-auth/stack-auth/blob/dev/CONTRIBUTING.md --> Adds JWT docs and JWT viewer component to docs <img width="1182" height="668" alt="image" src="https://github.com/user-attachments/assets/f4196dd9-e159-420e-9d78-a3928983f126" /> <!-- RECURSEML_SUMMARY:START --> ## High-level PR Summary This PR adds comprehensive JWT (JSON Web Token) documentation and an interactive JWT viewer component to the Stack Auth documentation. The main additions are a new documentation page explaining JWT concepts, structure, and usage within Stack Auth, along with a React component that allows users to decode and inspect JWT tokens. The JWT viewer can automatically load the current user's session token if they are signed in, or accept manually pasted tokens. The documentation provides examples of both client-side and server-side JWT usage, security considerations, troubleshooting guidance, and best practices. The PR also includes necessary updates to metadata files and component exports to integrate the new content into the documentation platform. ⏱️ Estimated Review Time: 15-30 minutes <details> <summary>💡 Review Order Suggestion</summary> | Order | File Path | |-------|-----------| | 1 | `docs/templates/concepts/jwt.mdx` | | 2 | `docs/src/components/mdx/jwt-viewer.tsx` | | 3 | `docs/docs-platform.yml` | | 4 | `docs/src/components/mdx/index.ts` | | 5 | `docs/src/mdx-components.tsx` | | 6 | `docs/templates/meta.json` | | 7 | `docs/templates-python/meta.json` | </details> <!-- RECURSEML_SUMMARY:END --> <!-- ELLIPSIS_HIDDEN --> ---- > [!IMPORTANT] > Adds a new JWT concepts page and an interactive `JWTViewer` component, integrating it into MDX and navigation, with `jose` added for decoding. > > - **Docs**: > - Add `concepts/jwt.mdx` with JWT structure, claims, examples, verification, security, and best practices. > - Include JWT page in navigation: `docs-platform.yml`, `templates/meta.json`, and Python `templates-python/meta.json`. > - **UI Component**: > - Add `JWTViewer` in `docs/src/components/mdx/jwt-viewer.tsx` to decode JWTs (header, payload, signature), show time-based indicators, and load current user token via `useUser()`. > - Export and register in MDX: `docs/src/components/mdx/index.ts`, `docs/src/mdx-components.tsx`. > - **Dependencies**: > - Add `jose` to `docs/package.json` (lockfile updated). > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=stack-auth%2Fstack-auth&utm_source=github&utm_medium=referral)<sup> forf25e369599. You can [customize](https://app.ellipsis.dev/stack-auth/settings/summaries) this summary. It will automatically update as commits are pushed.</sup> ---- <!-- ELLIPSIS_HIDDEN --> <!-- RECURSEML_ANALYSIS:START --> ## Review by RecurseML _🔍 Review performed on [ad34cfe..a135bbd](ad34cfecc2...a135bbdd77)_ ✨ No bugs found, your code is sparkling clean <details> <summary>✅ Files analyzed, no issues (3)</summary> • `docs/src/components/mdx/jwt-viewer.tsx` • `docs/src/mdx-components.tsx` • `docs/src/components/mdx/index.ts` </details> <details> <summary>⏭️ Files skipped (trigger manually) (4)</summary> | Locations | Trigger Analysis | |-----------|:------------------:| `docs/docs-platform.yml` | [ `docs/templates-python/meta.json` | [ `docs/templates/concepts/jwt.mdx` | [ `docs/templates/meta.json` | [ </details> [](https://discord.gg/n3SsVDAW6U) <!-- RECURSEML_ANALYSIS:END --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Interactive JWT Viewer in the docs: paste or auto-load a token to inspect header, payload, signature with live decoding, validity/time indicators, per-field copy controls, and "load my token". * **Documentation** * New "JWT" concept page covering structure, claims, examples, client/server/manual usage, security, troubleshooting, and best practices. * JWT page added to site navigation and enabled across Next, React, JS, and Python docs. * **Chores** * Added runtime dependency to support JWT decoding in the docs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds a new JWT concepts page and an interactive `JWTViewer` component, integrating it into MDX and navigation, with `jose` added for decoding. > > - **Docs**: > - Add `concepts/jwt.mdx` with JWT structure, claims, examples, verification, security, and best practices. > - Include JWT page in navigation: `docs-platform.yml`, `templates/meta.json`, and Python `templates-python/meta.json`. > - **UI Component**: > - Add `JWTViewer` in `docs/src/components/mdx/jwt-viewer.tsx` to decode JWTs (header, payload, signature), show time-based indicators, and load current user token via `useUser()`. > - Export and register in MDX: `docs/src/components/mdx/index.ts`, `docs/src/mdx-components.tsx`. > - **Dependencies**: > - Add `jose` to `docs/package.json` (lockfile updated). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit837fffb848. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Konsti Wohlwend <n2d4xc@gmail.com>
296 lines
8.6 KiB
YAML
296 lines
8.6 KiB
YAML
# Platform-specific content filtering configuration
|
|
# Explicit page-by-page listing approach
|
|
#
|
|
# NOTE: Changes to this file automatically update the smart platform navigation system.
|
|
# The src/lib/platform-navigation.ts file is auto-generated from this data during build.
|
|
|
|
pages:
|
|
# Root pages
|
|
- path: overview.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: faq.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
# SDK Reference
|
|
- path: sdk/index.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
# Components
|
|
- path: components/index.mdx
|
|
platforms: ["next", "react"] # Only React-like platforms
|
|
|
|
# Getting Started
|
|
- path: getting-started/setup.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: getting-started/components.mdx
|
|
platforms: ["next", "react"] # Only React-like platforms
|
|
|
|
- path: getting-started/users.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: getting-started/example-pages.mdx
|
|
platforms: ["js"] # Only vanilla JS
|
|
|
|
# Auth Providers - Available for all platforms since OAuth is universal
|
|
- path: concepts/auth-providers/index.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/github.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/google.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/facebook.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/microsoft.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/spotify.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/discord.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/gitlab.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/apple.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/bitbucket.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/linkedin.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/auth-providers/x-twitter.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
# Advanced auth methods - More frontend-focused
|
|
- path: getting-started/auth-providers/passkey.mdx
|
|
platforms: ["next", "react", "js"] # No Python (frontend feature)
|
|
|
|
- path: getting-started/auth-providers/two-factor-auth.mdx
|
|
platforms: ["next", "react", "js"] # No Python (frontend feature)
|
|
|
|
- path: getting-started/production.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
# Concepts
|
|
- path: concepts/stack-app.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/custom-user-data.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/user-onboarding.mdx
|
|
platforms: ["next", "react"] # No JS or Python
|
|
|
|
- path: concepts/oauth.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/orgs-and-teams.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/team-selection.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/permissions.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/api-keys.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/webhooks.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: concepts/backend-integration.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/jwt.mdx
|
|
platforms: ["next", "react", "js", "python"]
|
|
|
|
- path: concepts/emails.mdx
|
|
platforms: ["next", "react", "js"] # No Python (server-side email functionality)
|
|
|
|
# Components (React-like only)
|
|
- path: components/overview.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/user-button.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/selected-team-switcher.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/account-settings.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/sign-in.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/sign-up.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/credential-sign-in.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/credential-sign-up.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/magic-link-sign-in.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/forgot-password.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/password-reset.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/oauth-button.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/oauth-button-group.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/stack-handler.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/stack-provider.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: components/stack-theme.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
# Customization (React-like only)
|
|
- path: customization/dark-mode.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/custom-styles.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/internationalization.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/custom-pages.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/page-examples/index.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/page-examples/sign-in.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/page-examples/sign-up.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/page-examples/forgot-password.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
- path: customization/page-examples/password-reset.mdx
|
|
platforms: ["next", "react"]
|
|
|
|
# SDK Reference
|
|
- path: sdk/overview.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/overview-new.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/objects/stack-app.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/objects/stack-app-test.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/api-key.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/connected-account.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/contact-channel.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/project.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/team.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/team-permission.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/team-profile.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/team-user.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/user.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: sdk/types/email.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
# SDK Hooks (React-like only)
|
|
- path: sdk/hooks/use-stack-app.mdx
|
|
platforms: ["next", "react"] # No JS or Python
|
|
|
|
- path: sdk/hooks/use-user.mdx
|
|
platforms: ["next", "react"] # No JS or Python
|
|
|
|
# Snippets (utility files - exclude from Python)
|
|
- path: snippets/always-tab-codeblock.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/big-divider.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/divider.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/get-user-or-parameter.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/make-full-page.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/stack-app-constructor-options-after-ssk.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/stack-app-constructor-options-before-ssk.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: snippets/use-on-server-callout.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
# Others
|
|
- path: others/self-host.mdx
|
|
platforms: ["next", "react", "js", "python"] # All platforms
|
|
|
|
- path: others/supabase.mdx
|
|
platforms: ["next"] # Next only
|
|
|
|
- path: others/convex.mdx
|
|
platforms: ["next", "react", "js"] # No Python
|
|
|
|
- path: others/cli-authentication.mdx
|
|
platforms: ["python"] # Python only
|
|
|
|
# Python-specific content from templates-python/
|
|
# Authentication section
|
|
|
|
- path: concepts/user-authentication.mdx
|
|
platforms: ["python"] # python only
|
|
|
|
- path: concepts/teams-management.mdx
|
|
platforms: ["python"] # python only
|
|
|
|
|
|
|