Repository navigation
Send the configured signInOptions when signIn() is called without options - #158
brionmario wants to merge 1 commit into
Conversation
…ions The signInOptions configuration is documented as the extra parameters for the authorize request, but a redirect sign-in only sent the options passed to that call. A bare signIn() therefore dropped them, so an RFC 8707 resource indicator set there never reached a server that has no default resource server, and sign-in failed with invalid_target. ProtectedRoute and SignInButton worked around it by passing the context's signInOptions themselves. A redirect sign-in called without options, or with an empty options object, now sends the configured signInOptions, including on the silent sign-in tried before the redirect. Options passed to the call still take their place. The React playground gains VITE_THUNDERID_RESOURCE, passed as signInOptions.resource and shown in the Overview configuration, so it can sign in to a server without a default resource server. Signed-off-by: Brion <info@brionmario.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
🔀 Cross-SDK feature parityDoes this change need to ship in the other ThunderID SDKs too? This check stays red until one of these labels answers that:
Ports (DO NOT EDIT)
No sibling SDKs accounted for on this thread yet. Important Reply to this comment with this block, filled in. The boxes above tick A link can be a pull request or a tracked issue, written in full or as The contract is in the SDK development specification. |
Purpose
signInOptionsis documented as the extra parameters for the authorize request, but a redirect sign-in only sent the options passed to that call. A baresignIn()dropped them.That matters for the RFC 8707
resourceindicator. A ThunderID server binds every token to one resource server, so on a server with no default resource server, sign-in fails withinvalid_target: No resource parameter supplied and no default resource server is configuredunlessresourceis sent. Setting it on the provider (signInOptions={{resource}}) did nothing for an app that callssignIn()itself.ProtectedRouteandSignInButtononly worked because they pass the context'ssignInOptionsexplicitly.The React playground showed this. It has no way to send
resourceand callssignIn()without options, so it could not sign in to a stock server.Approach
@thunderid/browser: whensignIn()starts a redirect sign-in with no options, or an empty options object, it now sends the configuredsignInOptions. The same applies to the silent sign-in tried before the redirect, whensession.silentSignIn.beforeRedirectis on. Options passed to the call still take their place, soProtectedRoute,SignInButtonand any caller passing its own options behave as before. The empty-object case matters because the provider's callback handling callssignIn({callOnlyOnRedirect: true}), which is{}once that flag is removed. React, Vue, Next.js and Nuxt get this through@thunderid/browser.VITE_THUNDERID_RESOURCE, passed assignInOptions.resourceand shown in the Overview configuration, with.env.exampleand README entries.Testing
ThunderIDBrowserClient.signInOptions.test.ts: configured options are sent on a baresignIn()and onsignIn({}), the call's options take their place, and nothing extra is sent when none are configured. Two of its tests fail without the fix.@thunderid/browser(141 tests) and@thunderid/react(727 tests) pass. Type-check passes, and the change adds no lint errors toThunderIDBrowserClient.ts.@thunderid/vuetests are flaky in local browser mode onmaintoo (failing file counts change between runs). The Vue redirect sign-in test (authorization-details.test.ts) passes in isolation on this branch.VITE_THUNDERID_RESOURCE=https://localhost:8090/mcp.signIn()completes, the access token carriesscope: openid profile email system, anduseGrantedPermissions()returns the same, with hierarchicalcan()checks (systemgrantssystem:user:view). Without the variable, sign-in fails withinvalid_target, as before.Related Issues
Related PRs
No sample is affected: the only sample setting
signInOptions(b2b/manage) signs in throughProtectedRouteandSignInButton, which already pass them.Cross-SDK parity
signInOptionsto every authorize request.ThunderIDConfig.signInOptionsis declared but never used;buildSignInUrlonly addsprompt,login_hintandfidpfrom the call. Flutter on Android inherits this. Needs a port.Checklist
breaking changelabel added.parity/prs-raisedorparity/prs-not-neededadded.parity/prs-raised, the port links are posted as a reply on the parity check's comment.Security checks