okta-developer-docs icon indicating copy to clipboard operation
okta-developer-docs copied to clipboard

How to Convert an Okta User to the Federated Provider Type using Java SDK

Open oksanaspecter opened this issue 1 year ago • 5 comments

Thank you for getting involved with Okta's Developer Docs!

Note: If you are an Okta employee, please clone this Jira instead of opening a GitHub issue.

Please provide the following information so that we can act on your feedback.

Affected page(s): https://developer.okta.com/docs/reference/api/users/#request-example-convert-a-user-to-a-federated-user https://developer.okta.com/docs/reference/api/users/#provider-object https://support.okta.com/help/s/article/How-to-convert-Okta-user-to-Federated-provider-type?language=en_US#:~:text=To%20convert%20a%20user%20to,the%20FEDERATION%20as%20provider%20parameter.

Describe the problem(s): Able to convert Okta user into Federated user through Postman by setting a query parameter provider to FEDERATION. However, not able to do it programmatically as resetPasswod(Boolean sendEmail) in SDK doesnt accept provider parameter. How can we do it using java sdk? I did see in your migration documentation that resetPassword(Provider provider, Boolean sendEmail) has been deprecated. Whats an alternative solution to convert Okta user into a Federated user?

If possible, describe a proposed fix:

We will do our best to respond to you within 2 working days.

oksanaspecter avatar Aug 15 '24 00:08 oksanaspecter

@oksanaspecter Thanks for the feedback. I'll work with our engineering and SDK teams to get an update for you.

brianduffield-okta avatar Aug 15 '24 14:08 brianduffield-okta

Thank you. I ended up calling Okta API directly as the work around

 String url = "/api/v1/users/" + oktaId + "/lifecycle/reset_password";
    Map<String,String> queryParameters = new HashMap<>();
    queryParameters.put("sendEmail", "false");
    queryParameters.put("provider", "FEDERATION");
    oktaClient.http().setQueryParameters(queryParameters).post(url, VoidResource.class);

But still would like to know how can i leverage SDK library going forward.

oksanaspecter avatar Aug 15 '24 15:08 oksanaspecter

@oksanaspecter Currently, the Java SDK does NOT have a direct way to supply this query parameter provider for the resetPassword(...) a.k.a. generateResetPasswordToken(...) API because the public documentation (and OpenAPI spec) based on which the SDK is generated does not list this (https://developer.okta.com/docs/reference/api/users/#request-parameters-16).

We will work this out with the team that owns this API and update you.

Glad to know you found a workaround until then.

arvindkrishnakumar-okta avatar Aug 15 '24 16:08 arvindkrishnakumar-okta

Created internal ticket - OKTA-794001 for reference.

cc: @brianduffield-okta

arvindkrishnakumar-okta avatar Aug 16 '24 12:08 arvindkrishnakumar-okta

✅👍 ✅ list ⭐😀 ✨

smaug87 avatar Feb 13 '25 14:02 smaug87