javascript - auth0 router doesn't trigger navigation -


i'm using auth0 angular 2. have following login code don't go home page after authentication.

to understanding, auth0 not redirection. sends off authenticated event, , should create item in localstorage navigate home page.

@injectable() export class authservice {      lock = new auth0lock(this.config.clientid, this.config.domain, {         auth: {              responsetype: 'token',         }     });      constructor(private http: http, private config: appconfig, private router: router) {          // add callback lock `authenticated` event         this.lock.on('authenticated', (authresult) => {             localstorage.setitem('id_token', authresult.idtoken);             console.log(localstorage);             this.router.navigate(['home']);         });     } 

you can try location.replace('/home') or location.replace('http://localhost:4200/home')


Comments

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -