Add token refresh sample and improve error handling#14
Merged
Conversation
- Add React token-refresh sample with manual refresh via signinSilent() - Add required_scopes manifest field for scenario-specific scope warnings - Add error handling with error_hint display to all samples - Remove StrictMode to prevent double token exchange in dev - Remove silent-renew scenario (iframe approach unreliable with modern browsers) - Add Yarn config and Dependabot entry for token-refresh - Update aggregate script to support required_scopes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0489cda to
334a750
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new React “token refresh” SPA sample and wires it into the snippet/manifest system, while improving sample error visibility and avoiding React dev-mode double-invocation behavior.
Changes:
- Introduce new
spa_token_refreshscenario insnippets.jsonand the snippet manifests (includingrequired_scopesmetadata). - Add a new React sample app at
samples/react/token-refresh(Vite + Vitest) demonstrating manual refresh viasigninSilent(). - Improve React sample error handling by displaying OAuth
error_hint, and removeReact.StrictModefrom the login-pkce entrypoint.
Reviewed changes
Copilot reviewed 19 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| snippets.json | Adds spa_token_refresh snippet steps and enhances error UI to show error_hint. |
| snippet-manifest.yaml | Adds the new scenario (incl. required_scopes) to the aggregated manifest. |
| scripts/aggregate-manifests.ts | Extends scenario typing to include required_scopes. |
| samples/react/token-refresh/package.json | New sample package definition (deps/scripts). |
| samples/react/token-refresh/yarn.lock | Lockfile for the new sample. |
| samples/react/token-refresh/.yarnrc.yml | Yarn configuration for the new sample. |
| samples/react/token-refresh/.env.example | Documents required env vars for the token-refresh sample. |
| samples/react/token-refresh/index.html | New sample HTML entry. |
| samples/react/token-refresh/tsconfig.json | TypeScript config for the new sample. |
| samples/react/token-refresh/vite.config.ts | Vite config with env validation/injection. |
| samples/react/token-refresh/vitest.config.ts | Vitest config for the new sample. |
| samples/react/token-refresh/vitest.setup.ts | Vitest setup for jest-dom matchers. |
| samples/react/token-refresh/src/vite-env.d.ts | Types import.meta.env used by the sample. |
| samples/react/token-refresh/src/index.tsx | Renders the app without React.StrictMode. |
| samples/react/token-refresh/src/App.tsx | Implements the token refresh demo UI (manual refresh). |
| samples/react/token-refresh/src/App.test.tsx | Adds basic rendering tests for the new sample. |
| samples/react/token-refresh/README.md | Documents setup and intended behavior of the new sample. |
| samples/react/manifest.yaml | Registers spa_token_refresh scenario for React (incl. required_scopes). |
| samples/react/login-pkce/src/index.tsx | Removes React.StrictMode wrapper. |
| samples/react/login-pkce/src/App.tsx | Enhances error UI to show error_hint and retry button. |
| .github/dependabot.yml | Adds Dependabot updates for the new sample’s npm ecosystem. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add auth.isLoading handling to token-refresh TokenStatus - Add error rendering test and refresh button click test - Fix README to accurately describe both auto and manual refresh - Regenerate snippets Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
signinSilent()buttonrequired_scopesfield to manifest for scenario-specific scope validation in ciam-coreerror_hintdisplay to all sample apps for better error visibilityReact.StrictModeto prevent double token exchange in dev moderequired_scopes🤖 Generated with Claude Code