Skip to content

yashpalzala/otp_autofill_sms_consent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OTP autofill sms consent

Updated Flutter plugin to extract OTP from SMS for verification using the SMS User Consent API in Android along with working patch for Android 13 and above

This plugin uses the SMS User Consent API

The following criteria must meet for the API to be triggered:

  • The message contains a 4-10 character alphanumeric string with at least one number.
  • The message was sent by a phone number that's not in the user's contacts.
  • If you specified the sender's phone number, the message was sent by that number.

Usage

  _otpAutofillSmsConsent = OtpAutofillSmsConsent(
      pattern: r'\d{4,}',
      onAllowed: (sms) {
        _sms = sms;
        setState(() {});
      },
      onDenied: () {
        _scaffoldMessenger?.showSnackBar(
          const SnackBar(content: Text('User denied!')),
        );
      },
      onPatternUnmatched: () {
        _scaffoldMessenger?.showSnackBar(
          const SnackBar(
            content: Text('OTP not found! Please try entering OTP manually.'),
          ),
        );
      },
    )
      ..start('otpSender');

This plugin is extended version of another plugin created to fix the requirements of Android 13 and above.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published