verifyOTPCode method
Takes in M4eAuthOTPVerificationForm
parameter
and returns AuthToken
on success call
Throws AuthException
with NO_CACHED_AUTH_CREDENTIAL
error
code if no authentication credential exists
Throws ServerException
if call to server fails
Throws ServerException
with NO_INTERNET_CONNECTION
error
code if device is not connected to the internet
Implementation
Future<M4eAuthToken> verifyOTPCode(
M4eAuthOTPVerificationForm m4eAuthOTPVerificationForm) async {
if ((await _connectionChecker.hasConnection) ?? false) {
try {
final _m4eAuthPhoneNumberCredential =
await _authApi.getUserCredentialsFromCache();
final _authToken = await _authApi.verifyOTPCode(
_m4eAuthPhoneNumberCredential, m4eAuthOTPVerificationForm);
await _authApi.cacheAuthToken(_authToken);
return _authToken;
} catch (e) {
rethrow;
}
}
throw M4eExceptionMessages.kNoInternetConnectionException;
}