Redirect to appState.target does not work even when not using Quasar/router
stevage opened this issue · 0 comments
stevage commented
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:
- My app is not deployed at
/
- 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