Golang one-legged Oauth1

I am trying to generate a token so I can make one-legged Oauth 1 API calls, but I am having difficulty to understand how to do it in Golang.

I cannot find a package either. Hope someone can help me out.

I tried to get it working in Postman, this is working fine.

    req.Header.Add("Authorization", "OAuth oauth_consumer_key=\"xxxx\",oauth_signature_method=\"HMAC-SHA1\",oauth_timestamp=\"1712582585\",oauth_nonce=\"xxxx\",oauth_version=\"1.0\",oauth_signature=\"xxxx\"")

But now I need to translate it to Golang. The data that I have is an authentication_key and an authentication_secret.

That’s all I need to make the API calls.

Hope someone can help me out on how to create requests with a proper sign.

I tried to find packages, but none support one-legged OAuth 1 calls as far as I can see.

You’ll need the following standard Golang libraries:

  • net/http for making HTTP requests.
  • crypto/hmac and crypto/sha1 for generating the HMAC-SHA1 signature.
  • url for URL encoding.
  • time for generating timestamps.