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

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -