'How to validate phonenumber in Docusign Phone authentication
I have implemented Docusign Remote Signing Process and added phone authentication by setting identity verification for signer
signer.setIdentityVerification(recipientIdentityVerification());
public RecipientIdentityVerification recipientIdentityVerification() throws IOException, ApiException
{
RecipientIdentityPhoneNumber phoneNumber = new RecipientIdentityPhoneNumber();
phoneNumber.setCountryCode("+1");
phoneNumber.setNumber("**********");
RecipientIdentityInputOption inputOption = new RecipientIdentityInputOption();
inputOption.setName("phone_number_list");
inputOption.setValueType("PhoneNumberList");
inputOption.setPhoneNumberList(Arrays.asList(phoneNumber));
RecipientIdentityVerification identityVerifcation = new RecipientIdentityVerification();
identityVerifcation.setWorkflowId(getWorkflowID());
identityVerifcation.setInputOptions(Arrays.asList(inputOption));
return identityVerifcation;
}
Now if we give 10 digit random number, it throws an error code PHONE_NUMBER_INVALID with message Phonenumber is not valid. It only accepts genuine number for which we can get OTP. How to achieve this validation in my app. How can I validate phone numbers entered by our clients?
Solution 1:[1]
Yes, DocuSign validates the phone number. Not just the format, but also to ensure, for example, that the area code is valid and the phone number is valid (like a number doesn't start with 0 or 1 for example).
To validate the numbers yourself:
- On client - https://www.npmjs.com/package/react-phone-number-input
- On server - https://github.com/google/libphonenumber
The server validation above is more thorough and checks more things.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Inbar Gazit |