secretserver icon indicating copy to clipboard operation
secretserver copied to clipboard

Heartbeat Fails and getting throw Authentication Failed. Unknown error occurred. Does the user exist? when $responce is null

Open battlebudy opened this issue 1 year ago • 1 comments

Heartbeat Fails and getting "Authentication Failed. Unknown error occurred. Does the user exist? "when $responce is null

After a lot of testing and running this outside of Secret Server I found when running $response = Invoke-WebRequest -Uri $authUrl -Method POST -headers $headers -Body $body
the $response would be null causing $errormessage to also be null thus triggering the final else statement

else {
            write-log -ErrorLevel 0 -Message "Authentication Failed. Unknown error occurred. Does the user exist?"
            write-log -ErrorLevel 2 -Message $errormessage.error_description
            throw "Authentication Failed. Unknown error occurred. Does the user exist?"

when running just Invoke-WebRequest -Uri $authUrl -Method POST -headers $headers -Body $body alone and outside of a Variable I was presented with the following error

Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.

Adding -UseBasicParsing to the request fixed the issue $response = Invoke-WebRequest -Uri $authUrl -Method POST -headers $headers -Body $body -UseBasicParsing

battlebudy avatar May 10 '24 21:05 battlebudy

Seems like I did change this code in offline copy already. This is related to changes Microsoft did in if I recall Server 2022 in a recent patch. However, we actually moved this functionality natively in product if you are on Secret Server Cloud.

PatrickV-code avatar May 13 '24 07:05 PatrickV-code