npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

auth0-lock provides passwordless - unable to emit events


I am using auth0-lock npm library to use passwordless authentication in my single page application.
After signing up with email, I click on the link that is received in my inbox, and it just logs me in, I am unable to get the ‘authenticated’ event, to store the access_token. Trying to use the below code,

    const authOptions = {
       passwordlessMethod: "link",
       auth: {
	     redirectUrl: setting.APP.AUTH_REDIRECT_URL,
	     responseType: 'token id_token'
       allowedConnections: ["email"],
       closable: false,
       defaultDatabaseConnection: setting.APP.AUTH_CONNECTION

    var lock = this.isValid ?
        new Auth0LockPasswordless(
     		authOptions) :

lock.on('authenticated', authResult => {
		console.log("authresult  " + authResult);
		if (authResult && authResult.accessToken) {
			localStorage.setItem('accessToken', authResult.accessToken);
		} else {
			notification('error', 'Wrong mail or password');