Fix flow/meta in SSR SDKs + Nuxt SDK fixes - #81
Open
brionmario wants to merge 1 commit into
Open
Conversation
Signed-off-by: Brion <info@brionmario.com>
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Purpose
Bundles several related fixes found while working across the JavaScript SDKs on flow metadata and the embedded sign-in flow:
GET /flow/metarequired CORS in SSR frameworks.FlowMetaProviderfetched flow design config + i18n directly from the browser to the ThunderID server'sbaseUrl— a cross-origin request that required CORS to be configured server-side.@thunderid/nextjsand@thunderid/nuxtnow fetch it server-side by default (a Server Action in Next.js, a Nitro route in Nuxt) and seed it via SSR, so the browser never talks tobaseUrldirectly. Fixes thunder-id/thunderid#5010.SignIncomponents never trackedchallengeTokenacross multi-step flows, so any step after the first failed server-side validation (ICS-1002 Invalid challenge token). Both now track and resupply it, matching the React implementation.signOut()blocked on access token revocation.requestAccessTokenRevocation()was awaited insignOut()'s critical path with a 10s timeout, so a slow or unreachable revocation endpoint stalled the entire sign-out flow. It's now fired without awaiting, with the access token snapshotted first so a concurrentclearSessioncan't race it out of storage.<form>had no submit handler guard, so pressing Enter (or a submit-type button) could trigger the browser's native form submission — a GET request with all field values, including passwords, as query params. Submission is now fully intercepted viapreventDefault().--thunderid-*to--thunder-*for consistency with the vendor-prefix convention used elsewhere in the SDK.signin.images.app_logo.alt) and Nuxt/Next.js quickstart sample doc/env updates.Approach
FlowMetaProvider(in@thunderid/reactand@thunderid/vue) gained an optionalfetchMetaoverride andinitialMetaseed prop. Both default to the existing direct-browser-fetch behavior when unset, so plain React/Vue apps are unaffected.@thunderid/nextjsand@thunderid/nuxtpass these by default — a Server Action (getFlowMetaAction) and a Nitro route (/api/auth/meta) respectively — so the fetch happens server-to-server.SignIncontainers now hold achallengeTokenref, persist it via the storage manager's temporary data (so it survives OAuth redirects), and re-attach it on every flow step submission.Related Issues
flow/metais sent directly from the browser in Next.js & Nuxt SDKs requiring CORS on the ThunderID server thunderid#5010Related PRs
Checklist
breaking changelabel added.Security checks