Skip to content

Commit

Permalink
fix: forrce account selection on Google & GH OIDC
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-jonas committed Jan 24, 2025
1 parent b17786c commit 65125f6
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion packages/elements-react/src/components/form/useOryFormSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ export function useOryFormSubmit(
if (submitData.method === "code" && data.code) {
submitData.resend = ""
}
// Force the account selection screen on OIDC to provide a better user experience.
// https://github.com/ory/elements/issues/268
// TODO: Maybe this needs to be configurable in the configuration
if (
submitData.method === "oidc" &&
submitData.provider &&
supportsSelectAccountPrompt.includes(submitData.provider)
) {
submitData.upstream_parameters = {

Check warning on line 68 in packages/elements-react/src/components/form/useOryFormSubmit.ts

View check run for this annotation

Codecov / codecov/patch

packages/elements-react/src/components/form/useOryFormSubmit.ts#L68

Added line #L68 was not covered by tests
prompt: "select_account",
}
}

await onSubmitLogin(flowContainer, {
onRedirect,
Expand All @@ -73,6 +85,18 @@ export function useOryFormSubmit(
if (submitData.method === "code" && submitData.code) {
submitData.resend = ""
}
// Force the account selection screen on OIDC to provide a better user experience.
// https://github.com/ory/elements/issues/268
// TODO: Maybe this needs to be configurable in the configuration
if (
submitData.method === "oidc" &&
submitData.provider &&
supportsSelectAccountPrompt.includes(submitData.provider)
) {
submitData.upstream_parameters = {

Check warning on line 96 in packages/elements-react/src/components/form/useOryFormSubmit.ts

View check run for this annotation

Codecov / codecov/patch

packages/elements-react/src/components/form/useOryFormSubmit.ts#L96

Added line #L96 was not covered by tests
prompt: "select_account",
}
}

await onSubmitRegistration(flowContainer, {
onRedirect,
Expand Down Expand Up @@ -121,7 +145,7 @@ export function useOryFormSubmit(
submitData.method = "lookup_secret"
}

// Force the account selection screen on link to provide a better use experience.
// Force the account selection screen on link to provide a better user experience.
// https://github.com/ory/elements/issues/268
// TODO: Maybe this needs to be configurable in the configuration
if (
Expand Down

0 comments on commit 65125f6

Please sign in to comment.