Skip to content

fix(nextjs): apply signInOptions to the redirect-based sign-in - #555

Open
DonOmalVindula wants to merge 1 commit into
asgardeo:mainfrom
DonOmalVindula:fix/nextjs-signin-options
Open

fix(nextjs): apply signInOptions to the redirect-based sign-in#555
DonOmalVindula wants to merge 1 commit into
asgardeo:mainfrom
DonOmalVindula:fix/nextjs-signin-options

Conversation

@DonOmalVindula

Copy link
Copy Markdown
Contributor

Problem

  • signInOptions configured on <AsgardeoProvider> (for example {fidp: 'OrganizationSSO'} or {prompt: 'login'}) were never applied: signInAction built the authorize URL with getAuthorizeRequestUrl({}, sessionId), and the legacy Node client does not read signInOptions from the configuration by itself. The React SDK appends them.
  • <SignInButton signInOptions={{prompt: 'login'}}> failed on click: the action treated any non-empty payload as an embedded-flow step, AsgardeoNextClient.signIn() then called the legacy signIn without a callback, and the click ended in NODE-AUTH_CORE-SI-NF02 Invalid AuthURLCallback function.
  • Render-prop children of SignInButton received signIn and isLoading as undefined, and the JSDoc told users to rely on type="submit", which does nothing here.

Fix

  • signInAction only treats a payload with a flowId as an embedded-flow step. Anything else resolves the redirect-based sign-in URL with {...config.signInOptions, ...options} appended to the authorize request.
  • SignInButton tracks its loading state and passes signIn / isLoading to BaseSignInButton, so render props work as in the React SDK. Its docs show signInOptions and the render-prop usage.

Testing

  • New signInAction unit tests: no payload, empty payload, caller options merged over configured options, no configured options, an embedded-flow step, and reuse of an existing temporary session (66 tests pass).
  • pnpm lint and tsc --noEmit for @asgardeo/nextjs.

Changeset included (@asgardeo/nextjs patch).

🤖 Generated with Claude Code

The signInOptions configured on AsgardeoProvider were never appended to the
authorize request, and passing signInOptions to SignInButton made the click
fail: signInAction treated any non-empty payload as an embedded-flow step and
handed it to the legacy client, which rejected it for lack of a callback.

- signInAction only treats a payload with a flowId as an embedded-flow step;
  everything else resolves the redirect-based sign-in URL with the configured
  signInOptions and the caller's options appended.
- SignInButton tracks its loading state and passes signIn / isLoading to
  render-prop children, like the React SDK.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 1c5a7c19-fed9-47c8-9822-1f18a28ea735

📥 Commits

Reviewing files that changed from the base of the PR and between 409ebae and 0597f0e.

📒 Files selected for processing (4)
  • .changeset/nextjs-signin-options.md
  • packages/nextjs/src/client/components/actions/SignInButton/SignInButton.tsx
  • packages/nextjs/src/server/actions/__tests__/signInAction.test.ts
  • packages/nextjs/src/server/actions/signInAction.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@asgardeo-github-bot

Copy link
Copy Markdown

🦋 Changeset detected

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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