Jump to content

No credentials were available in the client certificate.


Go to solution Solved by electro,

Recommended Posts

Posted

I have a script that was working as expected until today. I have not changed anything in the code, so I presume something must have changed with either the computer or openai. Of interest 1 of my computers works fine, and the other 2 give an error. The error is "No credentials were available in the client certificate."

 

Global $oGlobalCOMErrorHandler = ObjEvent("AutoIt.Error", "_ErrFuncGlobal") ; Global COM error handler


$response = ChatGPT_Request("write a funny sentence")
ConsoleWrite($response)

Func ChatGPT_Request($message)
    Local $apiKey = "userkey"

    Local $url = "https://api.openai.com/v1/chat/completions"
    Local $headers = "Content-Type: application/json" & @CRLF & "Authorization: Bearer " & $apiKey
    Local $data = '{"model": "gpt-3.5-turbo", "messages": [{"role": "system", "content": "user: ' & $message & '"}], "max_tokens": 500}'

    Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
    $oHTTP.Open("POST", $url, False)
    $oHTTP.SetRequestHeader("Content-Type", "application/json")
    $oHTTP.SetRequestHeader("Authorization", "Bearer " & $apiKey)
    $oHTTP.Send($data)

    Local $response = $oHTTP.ResponseText

    Return $response
EndFunc

Func _ErrFuncGlobal($oError)
    ; Do anything here.
    MsgBox(0, 0, @ScriptName & " (" & $oError.scriptline & ") : ==> Global COM error handler - COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_ErrFuncGlobal

 

Posted

Of additional info updates KB5049981 and KB5050188 were installed on both computers that are no longer working around the time it started to fail.

  • Solution
Posted

Must be this was caused by a bad update, my computer ran another update, now KB5049981 is missing, and KB5049621 replaced it, and my script is working again as expected.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...