Still isAuthenticated after logout and localStorage clearage

So I have an application using Okta.

In a resolver for my navbar I have the following code:

resolve() {

if (this.Okta.isAuthenticated()){

    this.Identity.getMail().then((user) => this.CartService.getItemsOnStart(user.email))
  }

}

the problem is that no matter that it’s the first time I visit my site, all localStorage is clear and you’ve no idea who I am, it still goes into isAuthenticated. Here I’m getting the mail from your getUser endpoint which is undefined because you have no information about me.

Why does it go into isAuthenticated when there’s clearly no one authenticated?

Fixed by adding async and await