phone_email_auth 0.0.1 copy "phone_email_auth: ^0.0.1" to clipboard
phone_email_auth: ^0.0.1 copied to clipboard

Phone.email revolutionizes email communication by harnessing phone numbers as a seamless tool for your messaging needs. Whether you're an individual or a business, our advanced platform guarantees eff [...]

phone_email_auth plugin #

Flutter plugin for authenticating phone number. this plugin send OTP to mobile numbers and verify it and return verified mobile number to user.

Getting Started #

Install

    dependencies:
    phone_email_auth: ^0.0.1

Import

    import 'package:phone_email_auth/phone_email_auth.dart';

Initialize phone email plugin

    PhoneEmail.initializeApp(clientId: 'YOUR_CLIENT_ID',);

Note: #

clientId : Set clientId which you obtained from Profile Details section of Admin Dashboard of Phone Email.

Add Phone Email Login Button #

    
    child: PhoneLoginButton(
    borderRadius: 8,
    buttonColor: Colors.teal,
    label: 'Sign in with Phone',
    onSuccess: (String accessToken, String jwtToken) {
      if (accessToken.isNotEmpty) {
        setState(() {
          userAccessToken = accessToken;
          jwtUserToken = jwtToken;
          hasUserLogin = true;
        });
      }
    },
    )

The PhoneLoginButton will return the accessToken and jwtToken, which are necessary for obtaining the verified phone number.

Get Verified phone number: #

Once you've obtained the accessToken, get verified phone number by calling the getUserInfo() function. Use the following code snippet to retrieve the verified phone number.

        PhoneEmail.getUserInfo(
        accessToken: userAccessToken,
        clientId: phoneEmail.clientId,
        onSuccess: (userData) {
            setState(() {
            phoneEmailUserModel = userData;
            var countryCode = phoneEmailUserModel?.countryCode;
            var phoneNumber = phoneEmailUserModel?.phoneNumber;

            // Use this verified phone number to register user and create your session

            });
        },
        );

Display Email Alert: #

Integrate an email alert icon on your screen for a successfully authenticated user. Use the following code snippet to fetch the unread email count and display the email icon.

        floatingActionButton: hasUserLogin
            ? EmailAlertButton(
            jwtToken: jwtUserToken,
            ) : const Offstage(),
        );
2
likes
0
points
187
downloads

Publisher

unverified uploader

Weekly Downloads

Phone.email revolutionizes email communication by harnessing phone numbers as a seamless tool for your messaging needs. Whether you're an individual or a business, our advanced platform guarantees efficient, secure, and hassle-free communication, all powered by the convenience of your phone number.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dart_jsonwebtoken, flutter, flutter_inappwebview, http, shared_preferences

More

Packages that depend on phone_email_auth