如何在Okta Java SDK中发送短信挑战

问题描述 投票:0回答:1

在使用Okta Java API进行因素登记时,如何向给定的电话号码发送短信挑战?我的代码如下:

    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
    }
java sms okta
1个回答
0
投票

找到了。

VerifyFactorRequest verifyFactorRequest = client.instantiate(VerifyFactorRequest.class);
assert factor != null;
factor.verify(verifyFactorRequest);
© www.soinside.com 2019 - 2024. All rights reserved.