# Url replace after loginWithRedirect

**URL:** <https://community.auth0.com/t/url-replace-after-loginwithredirect/97928>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [January 11, 2023, 10:55am UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928 "2023-01-11T10:55:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![and](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/and/32/42524_2.png) [@and](https://community.auth0.com/u/and)\
**Post date:** [January 11, 2023, 10:55am UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/1 "2023-01-11T10:55:58Z")

</div>

Hello,

I saw similar thems, but not found solution. also checked SDK docs.  
I made simple SPA with Vue.  
Login with `loginWithRedirect()` method.  
SPA located in subdirectory `https://example.com/auth0-demo`

all works fine. After login redirects back to `/auth0-demo?code=...&status=...` and then url replaced to `/`, but i want to keep same path `/auth0-demo` i tried:

- `appStatus.target` - in `loginWithRedirect()`
- `openUrl()` - in `loginWithRedirect()` and in `createAuth0()`  
but nothing works. how to keep same path `/auth0-demo`?

Thank you for advice!

---

<div class="post-metadata">

**Author:** ![and](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/and/32/42524_2.png) [@and](https://community.auth0.com/u/and)\
**Post date:** [January 11, 2023, 6:36pm UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/2 "2023-01-11T18:36:01Z")

</div>

auth0-react works like a charm

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 12, 2023, 1:03pm UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/3 "2023-01-12T13:03:11Z")

</div>

Hey there!

Wanted to confirm, did you solve it with auth0-react SDK?

---

<div class="post-metadata">

**Author:** ![and](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/and/32/42524_2.png) [@and](https://community.auth0.com/u/and)\
**Post date:** [January 12, 2023, 3:27pm UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/4 "2023-01-12T15:27:52Z")

</div>

Hi,

Yes, with auth0-react all works as expected - path remains `/auth0-demo` after redirect.  
And of course auth0-spa-js works fine - there redirect is under full control.

---

<div class="post-metadata">

**Author:** ![and](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/and/32/42524_2.png) [@and](https://community.auth0.com/u/and)\
**Post date:** [January 12, 2023, 9:25pm UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/5 "2023-01-12T21:25:20Z")

</div>

Bug in `./src/plugin.ts` private method `__checkSession` :

```auto
const target = appState?.target ?? '/';
window.history.replaceState({}, '', '/');

```

target should be used in replaceState

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 13, 2023, 1:22pm UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/6 "2023-01-13T13:22:34Z")

</div>

Perfect! Glad to hear that!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 26, 2023, 11:45am UTC](https://community.auth0.com/t/url-replace-after-loginwithredirect/97928/7 "2023-01-26T11:45:52Z")

</div>


