okta / okta-developer-docs

okta-developer-docs
https://github.com/okta/okta-developer-docs
138 stars 598 forks source link

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

Open oksanaspecter opened 1 month ago

oksanaspecter commented 1 month ago

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.

brianduffield-okta commented 1 month ago

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

oksanaspecter commented 1 month ago

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.

arvindkrishnakumar-okta commented 1 month ago

@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 commented 1 month ago

Created internal ticket - OKTA-794001 for reference.

cc: @brianduffield-okta