Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with OAuth1.0 Authentication #492

Open
DLHeinze opened this issue Dec 23, 2023 · 1 comment
Open

Error with OAuth1.0 Authentication #492

DLHeinze opened this issue Dec 23, 2023 · 1 comment

Comments

@DLHeinze
Copy link

I'm trying to use OAuth1.0 to authenticate to an API. I am getting an error when it's preparing the http request.

The code is very simple. It builds just fine until I add the authentication part.

Any ideas?

ERROR - WebClient.Execute: -2147210493 (11011 / 80042b03), An error occurred during execute
-2147210492 (80042b04): An error occurred while preparing http request
-2146232576 (80131700): Automation error

Function Get_SingleRecord() As String
    Dim Client As New WebClient
    Client.BaseUrl = kBaseURL & "/"

    ' Setup authenticator
    Dim Auth As New OAuth1Authenticator
    Auth.Setup _
        ConsumerKey:=kconsumer_key, _
        ConsumerSecret:=kconsumer_secret, _
        Token:=koauth_token, _
        TokenSecret:=koauth_token_secret
    Set Client.Authenticator = Auth

    ' Use GetJSON helper to execute simple request and work with response
    Dim Resource As String
    Dim Response As WebResponse
    Resource = "restapi/1.0/object/contact/3"
    Set Response = Client.GetJson(Resource)
End Function

@DLHeinze
Copy link
Author

The error was at this line:
Set web_Crypto = CreateObject("System.Security.Cryptography.HMACSHA1")

Solution:
Installed MS .NET Framework 3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant