Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect URL for registration flow not respected when user is already registered #2420

Closed
4 of 6 tasks
mooijtech opened this issue Apr 23, 2022 · 5 comments
Closed
4 of 6 tasks
Labels
bug Something is not working.

Comments

@mooijtech
Copy link

Preflight checklist

Describe the bug

If I delete my cookies and run the registration flow for OIDC again I get the following:

Received successful OpenID Connect callback but user is already registered. Re-initializing login flow now.
Running ExecuteLoginPostHook.
Identity authenticated successfully and was issued an Ory Kratos Session Cookie.

But it is not respecting my returnTo URL (specified in code).

The returnTo URL does work if the user is not already registered.

Reproducing the bug

  1. Configure a OIDC provider (I used Microsoft)
  2. Perform register flow
  3. Delete cookies
  4. Perform register flow again
  5. Return URL is not respected (as specified in the initializeSelfServiceRegistrationFlowForBrowsers).

Relevant log output

No response

Relevant configuration

ory.initializeSelfServiceRegistrationFlowForBrowsers("/integrations/" + integration).then(({data}) => {
                setFlow(data)
            }).catch((error) => {
                if (error.response?.data.error?.id === "session_already_available") {
                    handleAuthenticated();
                } else {
                    return handleFlowError(router, "integrations/" + integration, setFlow)
                }
            })

router.push(`/integrations/${integration}?flow=${flow?.id}`, undefined, {shallow: true}).then(() =>
            ory.submitSelfServiceRegistrationFlow(String(flow?.id), {
                csrf_token: flow?.ui?.nodes?.[0]?.attributes?.value,
                method: "oidc",
                provider: integration,
            }).catch(
                handleFlowError(router, "integrations/" + integration, setFlow)
            ).catch((error) => {
                // If the previous handler did not catch the error it's most likely a form validation error.
                if (error.response?.status === 400) {
                    setFlow(error.response?.data)
                    return
                }

                return Promise.reject(error)
            })
        )

Version

v0.9.0-alpha.3

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Binary

Additional Context

No response

@mooijtech mooijtech added the bug Something is not working. label Apr 23, 2022
@mooijtech mooijtech changed the title Redirect URL not working: Received successful OpenID Connect callback but user is already registered. Re-initializing login flow now. Redirect URL for registration flow not respected when user is already registered Apr 23, 2022
@leecalcote
Copy link

I'm facing the same issue. Did you find a resolution or work-around for this, @mooijtech?

@mooijtech
Copy link
Author

@leecalcote Unfortunately not.
Seems to reference #2805 which is still in the latest release.

@supercairos
Copy link
Contributor

I'm working on a fix for this issue. It should be an easy fix

@supercairos
Copy link
Contributor

This can be closed as it's been merged into master

@mooijtech
Copy link
Author

@supercairos Thank you, appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

3 participants