# Embedded lock in Angular not working async

**URL:** <https://community.auth0.com/t/embedded-lock-in-angular-not-working-async/9500>\
**Category:** Get Help\
**Tags:** embedded-lock\
**Created:** [February 15, 2018, 6:29am UTC](https://community.auth0.com/t/embedded-lock-in-angular-not-working-async/9500 "2018-02-15T06:29:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sodhia.rohit](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sodhia.rohit](https://community.auth0.com/u/sodhia.rohit)\
**Post date:** [February 15, 2018, 6:29am UTC](https://community.auth0.com/t/embedded-lock-in-angular-not-working-async/9500/1 "2018-02-15T06:29:07Z")

</div>

I’m trying to implement Auth0 for the first time. I’m trying to use the embedded login in an Angular project and downloaded the git repo with the example. When I set it up and run it, the page redirects rather than working async. Looking at the code in the repo, I see a `handleAuthentication` method, which seems to indicate it should work async. Am I wrong in this? I also see the method called on page load, but I assumed that was for when someone visited the app having the token stored.

In general, I don’t really seem to get what’s going in the repo; I see the `callback-cross-auth.html`file, but I don’t see it included anywhere, and I’m not sure how it’s working.

Hope someone can lend me some advice?

---

<div class="post-metadata">

**Author:** ![andres.aguiar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/andres.aguiar/32/7718_2.png) [@andres.aguiar](https://community.auth0.com/u/andres.aguiar)\
**Post date:** [March 4, 2018, 4:03am UTC](https://community.auth0.com/t/embedded-lock-in-angular-not-working-async/9500/2 "2018-03-04T04:03:48Z")

</div>

Hi,

Browser based OAuth is implemented using the OAuth Implicit Grant, which requires invoking a callback that is registered with for your application in the authorization server. This implies there’s always a redirect to the callback url after logging-in. The handleAuthentication() method will get called after the redirect.

You can use:

```
var lock = new Auth0Lock(clientId, domain, {
    auth: {
      redirect: false
    }
  }
);

```

to avoid the redirect. In this case Lock will open a hidden iframe where it performs the authentication flow, and will post the access\_token and id\_token to the parent frame, which will end up calling handleAuthentication().

---

<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:** [July 25, 2019, 11:03am UTC](https://community.auth0.com/t/embedded-lock-in-angular-not-working-async/9500/3 "2019-07-25T11:03:23Z")

</div>


