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 to appState.target does not work even when not using Quasar/router #414

Open
6 tasks done
stevage opened this issue May 29, 2024 · 0 comments
Open
6 tasks done
Labels
bug This points to a verified bug in the code

Comments

@stevage
Copy link

stevage commented May 29, 2024

Checklist

  • The issue can be reproduced in the auth0-vue sample app (or N/A).
  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

The appState argument appears to be ignored here:

      this.$auth0.loginWithRedirect({

        appState: { target: '/thing/' },
      });

Instead, it always redirects to /. This is painful for me because:

  1. My app is not deployed at /
  2. The user may have provided search parameters which are obliterated in this redirect.

I think this PR would probably fix it: #226

I gave up, and implemented this workaround:

window.history.replaceState = new Proxy(window.history.replaceState, {
      apply: (target, thisArg, argArray) => {
        const search = new URLSearchParams(window.location.search);
        search.delete('code');
        search.delete('state');
        return target.apply(thisArg, [
          {},
          '',
          `${window.location.href.split('?')[0]}?${search.toString()}`,
        ]);
      },
    });

Reproduction

I can't spend more time on this. I have a workaround for my case. But basically, it's the same deal as #255, except I'm not using Quasar or vue-router.

The issue can be reproduced in the auth0-vue sample app (or N/A). *

I did not try this, but could not submit without checking that box.

Additional context

No response

auth0-vue version

2.3.33

Vue version

3.3.11

Which browsers have you tested in?

Firefox

@stevage stevage added the bug This points to a verified bug in the code label May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

1 participant