DustinEhle | Posts: 30

Add phone number to Signer for SMS authentication besides withSmsSentTo()?

0 votes
Hey, I am looking to include SMS authentication for a signer by first creating an authentication object and then including it in the constructor for the Signer object. I have been able to do this with the Q&A authentication as follows: Authentication auth = ChallengeBuilder.firstQuestion("What is your favorite sports team?") .answer(qaAnswer) .build(); Signer signer = new Signer(email, firstName, lastName, auth); signer.setId(id); signer.setCompany(company); signer.setPlaceholderName(placeholderName); return signer; HOWEVER, for SMS authentication, I do not see anyway to set the phone number using SMSAuthenticationBuilder or setting it on the Signer object. The only way I have been able to get the SMS authentication to work is by using the SignerBuilder: Signer signer = SignerBuilder.newSignerWithEmail(email) .withFirstName(firstName) .withLastName(lastName) .withSmsSentTo(phoneNumber) .build(); signer.setId(id); signer.setCompany(company); signer.setPlaceholderName(placeholderName); Is there someway to set the phone number for the SMS Authetnication method besides the withSmsSentTo() function? I looking to make our authentication method generation more dynamic and this would be a big help. Thanks! FYI, I am using Java SDK version 11.

Approved Answer
mwilliams | Posts: 957

Reply to: Add phone number to Signer for SMS authentication besides withSmsSentTo()?

0 votes
You might try this out:
Challenge myChallenge = new Challenge("+15555555555",null);
 Authentication auth = AuthenticationBuilder.newAuthenticationWithMethod(AuthenticationMethod.SMS).build();
auth.getChallenges().add(myChallenge);
Let me know if that works for you.

DustinEhle | Posts: 30

Reply to: Add phone number to Signer for SMS authentication besides withSmsSentTo()?

0 votes
This worked! Thanks!

mwilliams | Posts: 957

Reply to: Add phone number to Signer for SMS authentication besides withSmsSentTo()?

0 votes
Awesome! Not a problem at all!

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