Closed keepjhonnying closed 2 years ago
You can do something like this. Create a new dart file and put the following code. I haven't test it yet. Please try it by yourself.
extension AccountsPasswordless on MeteorClient {
Map<String, String> _transformSelector(dynamic selector) {
if (selector is! String) {
return selector;
}
if (selector.contains('@')) {
return {'email': selector};
}
return {'username': selector};
}
Future<void> requestLoginTokenForUser(
dynamic selector,
Map<String, dynamic> userData,
Map<String, dynamic> options,
) async {
await call('requestLoginTokenForUser', args: [
{
'selector': _transformSelector(selector),
'userData': userData,
'options': options,
}
]);
}
Future<MeteorClientLoginResult> passwordlessLoginWithToken(
dynamic selector,
String token,
) async {
return await login({
'selector': _transformSelector(selector),
'token': token,
});
}
}
Thank you @tanutapi for your time and response. I`ll try!
It works perfectly @tanutapi. Thank u!!!
Hi;
Any tips on how to use the Accounts-passwordless [https://docs.meteor.com/packages/accounts-passwordless.html] package with this library?