Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0-lock branch should be updated #20

Open
camel113 opened this issue Nov 23, 2016 · 2 comments
Open

Auth0-lock branch should be updated #20

camel113 opened this issue Nov 23, 2016 · 2 comments

Comments

@camel113
Copy link

I think that the current example is not working anymore. I am currently using v 10.6.1. And for redux, react, and auth0 working together I did some change to the login function in action.js.
First you have to set redirect:falsewhen declaring Auth0Lock. If you are not doing it the page will be refreshed and your async function will never be called.
Then you need to use lock.on to get event from Auth0Lock and calling your actions. Below a short example.

export function login() {
	console.log("login()")
  const lock = new Auth0Lock('xx', 'xx.eu.auth0.com',{auth:{redirect:false}});
  return dispatch => {
  	lock.show()
  	lock.on('authenticated', function(authResult){
  		localStorage.setItem('idToken', authResult.idToken);
  		dispatch(lockSuccess(authResult.profile, authResult.token))
  	})
  }
}

What do you think?

@jasonkim
Copy link

This helped me a bit to understand. More specifically, it looks like there needs some way to process the successful login after the redirect happens. (that is if you do want the redirect)

https://github.com/amaurymartiny/react-redux-auth0-kit/blob/master/src/containers/App/AppView.js

@HirenPatel2791
Copy link

Hi, any updates on this, the current example doesn't work with latest react and lock :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants