Sending sms challenge using Java SDK

How can I send an sms challenge to the phone number given while enrolling to the factor using Okta Java API? My code is as follows:

Client client =  Clients.builder()
		.setOrgUrl(hostname)
		.setClientCredentials(new TokenClientCredentials(apikey))
		.build();

User user = client.getUser(email);
FactorList factors = user.listFactors();
Factor factor = null;
for (Factor f : factors) {
	if (f.getFactorType().toString().equals(authFactor)) {
		factor = f;
	}
}
if (factor != null && factor.getStatus().toString().equalsIgnoreCase("active")) {
	VerifyFactorRequest verifyFactorRequest = client.instantiate(VerifyFactorRequest.class);
	// send sms challenge
}

Found it.

VerifyFactorRequest verifyFactorRequest = client.instantiate(VerifyFactorRequest.class);
assert factor != null;
factor.verify(verifyFactorRequest);

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.