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
Post a Comment