verifyOtp method

Future<void> verifyOtp({
  1. required String sessionId,
  2. required String otp,
  3. required OnSuccessCallback onSuccess,
  4. required OnErrorCallBack onError,
  5. OnProfileSelection? onProfileSelection,
})

Verify the OTP for sessionId.

On a single-profile account onSuccess fires with the session. When the phone number maps to multiple profiles, onProfileSelection fires instead with the list of UserProfiles to choose from — retain sessionId and otp and complete login via the select-user step. If onProfileSelection is omitted, a multi-profile account reports through onError.

Implementation

Future<void> verifyOtp({
  required String sessionId,
  required String otp,
  required OnSuccessCallback onSuccess,
  required OnErrorCallBack onError,
  OnProfileSelection? onProfileSelection,
}) {
  return _bridge.invoke(
    'Extension.verifyOtp',
    params: {'sessionId': sessionId, 'otp': otp},
    callbacks: {
      'onSuccess': onSuccess,
      'onError': onError,
      if (onProfileSelection != null) 'onProfileSelection': onProfileSelection,
    },
  );
}