# I am using Auth0 Single Page App SDK, do I have to be redirected to a new page after login?

**URL:** <https://community.auth0.com/t/i-am-using-auth0-single-page-app-sdk-do-i-have-to-be-redirected-to-a-new-page-after-login/70058>\
**Category:** Get Help\
**Tags:** api, auth0, login\
**Created:** [September 22, 2021, 2:22am UTC](https://community.auth0.com/t/i-am-using-auth0-single-page-app-sdk-do-i-have-to-be-redirected-to-a-new-page-after-login/70058 "2021-09-22T02:22:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwtractorcontact](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gwtractorcontact/32/31860_2.png) [@gwtractorcontact](https://community.auth0.com/u/gwtractorcontact)\
**Post date:** [September 22, 2021, 2:22am UTC](https://community.auth0.com/t/i-am-using-auth0-single-page-app-sdk-do-i-have-to-be-redirected-to-a-new-page-after-login/70058/1 "2021-09-22T02:22:05Z")

</div>

after createAuth0Client, I am using auth0.loginWithRedirect. Could I stay same page without refreshing or redirecting to a new page after login? could I use javascript function to handle post-login action. I tried auth0.handleRedirectCallback, but it wouldn’t be triggered. which function/parameters should I use? thanks.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 22, 2021, 6:04pm UTC](https://community.auth0.com/t/i-am-using-auth0-single-page-app-sdk-do-i-have-to-be-redirected-to-a-new-page-after-login/70058/3 "2021-09-22T18:04:01Z")

</div>

Hi @gwtractorcontact,

Welcome to the Auth0 Community!

I understand that you have questions regarding login redirection.

Unfortunately, the Auth0 Single Page Application SDK only supports `loginWithPopup` and `loginWithRedirect` methods. Because of this, you will not be able to avoid a page redirection or refresh.

With that said, I recommend that you use the [`loginWithRedirect`](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#loginwithredirect) method to your same page to authenticate the user and allow them onto the application for their account. Or use [`loginWithPopup`](https://auth0.github.io/auth0-spa-js/classes/auth0client.html#loginwithpopup) and refresh the current page.

Please let me know if you have any questions. I would be happy to help.

EDIT:

> [@gwtractorcontact](#):
>
> could I use javascript function to handle post-login action.

Yes, you can use a [Post-Login Action](https://auth0.com/docs/actions/triggers/post-login) to implement custom behavior after the user has authenticated.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 6, 2021, 10:55pm UTC](https://community.auth0.com/t/i-am-using-auth0-single-page-app-sdk-do-i-have-to-be-redirected-to-a-new-page-after-login/70058/4 "2021-12-06T22:55:19Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
