loginByPhoneCode static method
Future<AuthResult>
loginByPhoneCode(
- String phone,
- String passCode, [
- String? phoneCountryCode,
- LoginOptions? options,
login by phone number and an SMS verification code.
Implementation
static Future<AuthResult> loginByPhoneCode(String phone, String passCode,
[String? phoneCountryCode, LoginOptions? options]) async {
Map map = {};
map.putIfAbsent('phone', () => phone);
map.putIfAbsent('passCode', () => passCode);
if (phoneCountryCode != null) {
map.putIfAbsent('phoneCountryCode', () => phoneCountryCode);
}
var body = {
'connection': 'PASSCODE',
'passCodePayload': map,
};
var jsonBody = jsonEncode(body);
if (options != null) {
jsonBody = jsonEncode(options.setValues(body));
}
final Result result = await post('/api/v3/signin', jsonBody);
AuthResult authResult = AuthResult(result);
authResult.user = await createUser(result);
return authResult;
}