Directly pass the mobile number to Digits

78 views Asked by At

I want to authenticate user on registration, I have a mobile number field in registration form. When user clicks on submit (Submit button is digits buttton ) he should receive the otp and redirected to the otp page, where he will enter the otp. I just want to skip the screen where user manually enters the mobile number.

     DigitsAuthButton digitsButton = (DigitsAuthButton) 
     findViewById(R.id.auth_button);
 digitsButton.setCallback(new AuthCallback() {

 @Override
        public void success(DigitsSession session, String phoneNumber) {
            // TODO: associate the session userID with your user model
            Toast.makeText(getApplicationContext(), 
   "Authenticationsuccessful for " + phoneNumber, Toast.LENGTH_LONG).show();
        }

        @Override
        public void failure(DigitsException exception) {
            Log.d("Digits", "Sign in with Digits failure", exception);
        }
    });
1

There are 1 answers

9
Andy Developer On

You can achieve this using following way. I always prefer this for my App Development so this give you some hint.

When you click the Submit button your API register your mobile number and send the SMS on your mobile you just read that SMS from back-end and read the OTP and again hit your API so, from this way you can skip manual OTP screen.