Forum Discussion

sal21's avatar
sal21
New Contributor
2 years ago

https://developers.openapi.it/ and counter

I'm on vba. I need to set my get statement, for https://developers.openapi.it/services/oauth#tag/counters   i just have email of my account and apykey   This is my code for all my get statement ...
  • ponelat's avatar
    2 years ago

    Hi sal21 ,

     

    Looks like your API requires HTTP Basic authentication.  It's a base64 encoded string, made up of your username + colon (:) + password, eg:
    User = "josh"

    Password = "pa$$"

     

    String = "josh:pa$$"

    String after base64 encoding: "am9zaDpwYSQk"

    Then the full header is:

    "Authorization: Basic am9zaDpwYSQk" 

     

    I don't know VBA, but a Google showed this snippet, which may work for you...

     

    user = "someusername"
    password = "somepassword"
    xmlhttp.setRequestHeader "Authorization", "Basic " + Base64Encode(user + ":" + password)
    

     

    See: https://swagger.io/docs/specification/authentication/basic-authentication/ to learn about Basic Auth.