How to use the xdl.User.loginAsync function in xdl

To help you get started, we’ve selected a few xdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-community / create-react-native-app / react-native-scripts / src / util / expo.js View on Github external
{
      type: 'password',
      name: 'password',
      message: 'Password:',
      validate: validator,
    },
  ];

  const answers = await inquirer.prompt(questions);

  const data = {
    username: answers.username,
    password: answers.password,
  };

  let user = await UserManager.loginAsync('user-pass', data);

  if (user) {
    console.log(chalk.green(`\nSuccessfully logged in as ${user.nickname}!`));
    return user;
  } else {
    throw new Error('Unexpected Error: No user returned from the Expo API');
  }
}
github expo / exp / src / accounts.js View on Github external
if (val.trim() === '') {
          return false;
        }
        return true;
      },
    });
  }

  const answers = await prompt(questions);

  const data = {
    username: username || answers.username,
    password: password || answers.password,
  };

  let user = await UserManager.loginAsync('user-pass', data);

  if (user) {
    console.log(`\nSuccess. You are now logged in as ${chalk.green(user.username)}.`);
    return user;
  } else {
    throw new Error('Unexpected Error: No user returned from the API');
  }
}
github react-community / create-react-native-app / react-native-scripts / src / util / expo.js View on Github external
async function githubAuthAsync(): Promise {
  let user = await UserManager.loginAsync('github');
  if (user) {
    console.log(chalk.green(`\nSuccessfully logged in as ${user.nickname} with GitHub!`));
    return user;
  } else {
    throw new Error('Unexpected Error: No user returned from the API');
  }
}
github expo / xde / src / ui / LoginPage.js View on Github external
_onSubmitLogin = (event) => {
    event.preventDefault();

    this.setState({isLoggingIn: true});
    User.loginAsync({
      username: this.state.username,
      password: this._passwordInput.value,
    }).then((user) => {
      this.setState({errorMessage: null, isLoggingIn: false});
      this.props.onLogin(user);
    }, (err) => {
      this.setState({errorMessage: err.message, isLoggingIn: false});
    });
  };