Lock v11 in React app not catching 'authenticated' event

I’m trying to implement Lock v11 in a React app and I’m confused about:

  1. Where do I initialize Lock? In index.js or componentWillMount() in App.js?

  2. Where do place the lock.on('authenticated') listener?

I currently initialize Lock through my reducer and placed the lock.on('authenticated') listener in componentWillMount() in App.js but it’s not firing. I do see an access_token in the URL but I’m not hitting the debugger I placed in the event listener.

I could use clarification on how to implement Lock v11 in a React app. Thanks.

Hey there!

Looking at this document about Lock and its first paragraph:

https://auth0.com/docs/libraries/lock/v11/configuration

it seems that you need to initialize Lock in index file and judging by this doc:

the listener should be placed within the same file where you initialized Lock.