loginByPhoneCode static method
login by phone number and an SMS verification code.
Implementation
static Future<AuthResult> loginByPhoneCode(String phone, String code,
{AuthRequest? authData}) async {
var body = jsonEncode({'phone': phone, 'code': code});
final Result result = await post('/api/v2/login/phone-code', body);
AuthResult authResult = AuthResult(result);
authResult.user = await createUser(result);
if (authData == null) {
return authResult;
} else {
if (authResult.code == 200) {
authData.token = authResult.user?.token ?? "";
return OIDCClient.authByToken(authData.token, authData);
} else {
return authResult;
}
}
}