rvardy | Posts: 3

SMS Input validation

0 votes
I'm trying to validate user input on the front end to match the format of strings that oneSpan will accept for phone numbers. Is there any official documentation for this format?

Duo_Liang | Posts: 3776

Reply to: SMS Input validation

0 votes
Hey rvardy, Unfortunately, I didn't find anywhere it's officially documented, but from practice, the SMS Authentication format should be +{International_Access_Code}{area_code}{local_phone_number} (without space or dash in the middle) , for a North American phone number, it should be +1{3 digits area code}{7 digits local number} (+15145718888) You can find a lot of JS plugin helping you do the digit checking, like the one used in this blog: OneSpan Sign Developer: SMS Authentication Plugin. Hope this could help! Duo

rvardy | Posts: 3

Reply to: SMS Input validation

0 votes
Hey Duo, Do you know what the validations are for the other standard fields (first name, last name, and email)? It seems that the name fields accept a minimum of 2 characters, just wondering what other requirements must be met. Cheers, Rob

Duo_Liang | Posts: 3776

Reply to: SMS Input validation

0 votes
Hey rob, From a quick test, I can create a signer with first name of 1 character. But if the length is longer than 64, the name will only take the first 64 digits. For an email attribute, it should follow email address regular expression, otherwise a 400 error will be returned:
{
    "code": 400,
    "messageKey": "error.validation.invalidEmail",
    "message": "Email address is invalid: '@mailinator.com'"
}
Duo

Duo_Liang | Posts: 3776

Reply to: SMS Input validation

0 votes
Hey Rob, After some time of investigation, it looks like OneSpan Sign backend is using Apache Commons Validator 1.6 to validate user name, email address and email domain. (this explains why there's a max 64 chars limitation) To be more exact, it's using org.apache.commons.validator.routines.EmailValidator.java class, source code here, which might be helpful to you. As we discussed above, you can still rely on the OneSpan Sign server side to validate the email. Hope this could help! Duo

rvardy | Posts: 3

Reply to: SMS Input validation

0 votes
Thanks Duo, That's exactly what I was looking for. Do you know If there's a similar library being used to validate the phone number input? Cheers

Duo_Liang | Posts: 3776

Reply to: SMS Input validation

0 votes
Hey Rob, Try libphonenumber from Google. Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off