API Question about how to capture -UseDefaultCredentials in UD endpoint

Hi, I am very new to this. I have search a bit but i can’t find any post related to this. If you know this is some old post. Can you please redirect. Thank you so much.

I have created an API endpoint using Powershell UD. I am trying to capture the defaultcredential in the endpoint. What I understand if we use the following invoke-restmethod with -UserDefaultCredentials, the logged in user credential of where the Windows host that invoke the following command will pass in the endpoint and able to used in the endpoint as part of logic. i am not sure if I am fully understand correctly. If not why we need to use -UseDefaultCredentials and what is the different without? If there is an example how to get the credential in end point, can you please share the example? Thanks.

Invoke-RestMethod “http://localhost:8080/api/test” -Method POST -UseDefaultCredentials

Hi @danielcheong,

I would asume that -usedefaultcredentials would only work if you had configured UD to autenticate to a AD via “Windows Authentication”.

Which auth provider do you use for your UD?