<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D50Z00008G7WAQSA3Okta Classic EngineMulti-Factor AuthenticationAnswered2019-04-22T14:22:46.000Z2017-12-08T20:01:16.000Z2019-04-22T14:22:46.000Z
Java - Add Factor on Registration

We required the "Security Question" MFA and I was trying to write the code to add the factor but keep receiving an error message: 

 
  1.  HTTP -1, Okta E0000003 (The request body was not well-formed.), ErrorId oaed7Qo2BLCQkm8YzCb8tF5KQ
 

Code:

 
  1.  com.okta.sdk.resource.user.User newUser = UserBuilder.instance()<add_stuff_here>.setActive(false).buildAndCreate(oktaClient); Iterator<Factor> factors = newUser.listSupportedFactors().iterator(); while (factors.hasNext()) {  Factor factor = factors.next();  if (factor instanceof SecurityQuestionFactor) {  SecurityQuestionFactor sqf = (SecurityQuestionFactor) factor;  SecurityQuestionFactorProfile profile = sqf.getProfile();  profile.setQuestion("name_of_first_plush_toy");  profile.setAnswer("Hardcoded");  sqf.setProfile(profile);  newUser.addFactor(sqf);  newUser.activate(false); }
 I wasn't sure what part of the request body was not well-formed (newUser.addFactor(sqf); is the location of the exception)

AnilA.94109 likes this.
  • FlavelH.49645 (Customer)

    Nevermind, found out how to instantiate Factors:  oktaClient.instantiate(SecurityQuestionFactor.class);
    Selected as Best
  • FlavelH.49645 (Customer)

    Nevermind, found out how to instantiate Factors:  oktaClient.instantiate(SecurityQuestionFactor.class);
    Selected as Best
  • RafaelW.15613 (Customer)

    Hey, how can I do the same with Javascript(okta nodejs sdk)

    Thanks!

This question is closed.
Loading
Java - Add Factor on Registration