signInWithEmailPasswordless method

  1. @override
Future<void> signInWithEmailPasswordless(
  1. String email, {
  2. String? redirectTo,
})

Signs in a user with a magic link.

An email will be sent to the email with a link. When the user clicks on the link the user will be automatically redirected to redirectTo with a refresh token as a hash argument. This value can then be used to sign in via signInWithRefreshToken.

Throws an NhostException if sign in fails.

Implementation

@override
Future<void> signInWithEmailPasswordless(
  String email, {
  String? redirectTo,
}) async {
  log.finer('Attempting sign in (passwordless email)');
  return _apiClient.post(
    '/signin/passwordless/email',
    jsonBody: {
      'email': email,
      if (redirectTo != null)
        'options': {
          'redirectTo': redirectTo,
        },
    },
  );
}