How to wait for this.auth.login() using Angular 6

I’m trying to write login code in Angular 6. My issue is I have a “navbar” component.

I have a simple login() method that calls the main auth0 login. The code looks like this:

login() {
  <... more code here...>

However, I need the code to wait for the login to complete.

I have more code that needs to run after the login, but the code executes before the login is completed.

How can I do this in Angular 6?

I believe I’m supposed to subscribe or use an Observable or Promise.

Does anyone have some sample code on how to make this work?


Hey there!

Sorry for such delay in response! We’re doing our best in providing the best developer support experience out there, but sometimes the number of incoming questions is just too big for our bandwidth. Sorry for such inconvenience!

Do you still require further assistance from us?