Force.com-Toolkit-for-NET icon indicating copy to clipboard operation
Force.com-Toolkit-for-NET copied to clipboard

Reset password for a User via ForceClient

Open koide opened this issue 7 years ago • 2 comments

I'm trying to use the following method for resetting a password for a User: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_user_password.htm

I'm failing to see how can I call that API route and get the new password response with this toolkit, as JsonHttpClient's DeleteAsync methods return bool, overriding the BaseClient's DeleteAsync which returns string.

I have thought of several alternatives, but I'm not sure which one, if any, would be accepted as a pull request. Please let me know if there's a way I missed to call and get the response for resetting a password, or which approach would be considered okay.

koide avatar Oct 08 '18 07:10 koide

Hi @koide, any progress on this issue? I'm trying to set / reset password but cannot find a way to do this

leobel avatar Feb 19 '19 14:02 leobel

I did it outside the library with direct requests to the API, @leobel, see https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_user_password.htm

I reused the Authentication client from the library to get the AccessToken, ApiVersion and InstanceUrl. Then I just did a DELETE request to $"{_auth.InstanceUrl}/services/data/{_auth.ApiVersion}/sobjects/User/{id}/password" with a regular HTTP library, adding the Authorization header with the Token. {id} is the Salesforce Id of the user you want to reset the password to.

koide avatar Mar 01 '19 08:03 koide