2
votes

Working off the auth0 lock react auth redux example here: https://github.com/auth0-blog/redux-auth/tree/auth0-lock

And using it for react native, I'm trying to call an auth0 login screen as part of my action dispatch in a redux react native app and I'm getting the error "Cannot have a non-function arg after a function arg" What does that error mean and why does it happen when I'm trying to call an auth0 lock function from within an action dispatch?

// actions.js

function showLogin() {
  return {
    type: LOGIN_REQUEST,
  };
}

function loginSuccess(profile, token) {
  return {
    type: LOGIN_SUCCESS,
    profile,
    token,
  };
}

function loginError(err) {
  return {
    type: LOGIN_FAILURE,
    err,
  };
}

export function login() {
  return (dispatch) => {
    dispatch(showLogin());
    // it seems to error on the next line here calling the auth0 login method
    lock.show((err, profile, token) => {
      if (err) {
        // handle error
        return dispatch(loginError(err));
      }
      return dispatch(loginSuccess(profile, token));
    });

  };
}
1

1 Answers

0
votes

Based on the question tags I'm assuming that the lock variable refers to the Auth0 Lock made available in react-native-lock.

If that's the case, the API docs indicate that the show method declares two parameters options and callback, but you're only passing a single argument when you call it.