# Handle appState and redirect to dynamic url after successful login(Auth0 Angular)

**URL:** <https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982>\
**Category:** Get Help\
**Tags:** auth0, login\
**Created:** [October 5, 2020, 11:01am UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982 "2020-10-05T11:01:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kav.khalsa](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kav.khalsa/32/12789_2.png) [@kav.khalsa](https://community.auth0.com/u/kav.khalsa)\
**Post date:** [October 5, 2020, 11:01am UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982/1 "2020-10-05T11:01:40Z")

</div>

In the Auth0 Spa JS, I could execute the auth0.handleRedirectCallback() function to return the appState from the auth0.loginWithRedirect({appState}) when it is passed in. This used to allow me to redirect to any url I wanted after a successful login or successfully completing an auth guard, into my application.

In the new auth0/angular library the auth0.handleRedirectCallback() is now private and can’t be used outside the class. Therefore, how is appState returned and used in the new implementation?

Thanks, Kav

---

<div class="post-metadata">

**Author:** ![rlopez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rlopez/32/16048_2.png) [@rlopez](https://community.auth0.com/u/rlopez)\
**Post date:** [May 21, 2021, 4:53pm UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982/2 "2021-05-21T16:53:45Z")

</div>

I have the same problem. Any news ?

---

<div class="post-metadata">

**Author:** ![Fearny-RB](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/fearny-rb/32/17695_2.png) [@Fearny-RB](https://community.auth0.com/u/Fearny-RB)\
**Post date:** [June 15, 2021, 2:00pm UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982/3 "2021-06-15T14:00:04Z")

</div>

@kav.khalsa, @rlopez  
I just submitted a PR that adds an `appState$` observable to the `AuthService` class: [https://github.com/auth0/auth0-angular/pull/168](https://github.com/auth0/auth0-angular/pull/168)

If/when this PR gets merged, you can subscribe to this observable to receive the `appState` after the user gets redirected back to your application:

```plaintext
import { Component, OnInit } from '@angular/core';
import { AuthService } from '@auth0/auth0-angular';

@Component({
  selector: '...',
  templateUrl: '...',
  styleUrls: ['....'],
})
export class AppComponent implements OnInit {
  constructor(public auth: AuthService) {}

  ngOnInit() {
    this.auth.appState$.subscribe((appState) => {
      console.log(appState);
    });
  }
}

```

---

<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:** [June 15, 2021, 2:06pm UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982/4 "2021-06-15T14:06:31Z")

</div>

Thanks for doing that and sharing with the rest of community!

---

<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:** [June 25, 2021, 11:23am UTC](https://community.auth0.com/t/handle-appstate-and-redirect-to-dynamic-url-after-successful-login-auth0-angular/50982/5 "2021-06-25T11:23:35Z")

</div>


