Skip to content

Add token refresh sample and improve error handling#14

Merged
ksroda-sa merged 4 commits into
mainfrom
feat/token-refresh-sample
Apr 16, 2026
Merged

Add token refresh sample and improve error handling#14
ksroda-sa merged 4 commits into
mainfrom
feat/token-refresh-sample

Conversation

@ksroda-sa

Copy link
Copy Markdown
Collaborator

Summary

  • Add React token-refresh sample with manual refresh via signinSilent() button
  • Add required_scopes field to manifest for scenario-specific scope validation in ciam-core
  • Add OAuth error_hint display to all sample apps for better error visibility
  • Remove React.StrictMode to prevent double token exchange in dev mode
  • Remove silent-renew scenario (iframe-based approach unreliable with third-party cookie restrictions in modern browsers)
  • Update aggregate script interface to support required_scopes

🤖 Generated with Claude Code

- 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>

Copilot AI 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.

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_refresh scenario in snippets.json and the snippet manifests (including required_scopes metadata).
  • Add a new React sample app at samples/react/token-refresh (Vite + Vitest) demonstrating manual refresh via signinSilent().
  • Improve React sample error handling by displaying OAuth error_hint, and remove React.StrictMode from 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.

Comment thread samples/react/token-refresh/src/App.tsx
Comment thread snippets.json Outdated
Comment thread samples/react/token-refresh/README.md Outdated
Comment thread samples/react/token-refresh/src/App.test.tsx
Comment thread samples/react/token-refresh/src/App.test.tsx
ksroda-sa and others added 3 commits April 16, 2026 12:03
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>
@ksroda-sa ksroda-sa marked this pull request as ready for review April 16, 2026 10:11
@ksroda-sa ksroda-sa merged commit d08f3c7 into main Apr 16, 2026
9 checks passed
@ksroda-sa ksroda-sa deleted the feat/token-refresh-sample branch April 16, 2026 10:16
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