I'm quite new to Oauth, but need to learn how to do it in Java so that we can authenticate a REST request. Here's what I've got so far.
After a bit of reading, I decided to try ScribeJava. I made a custom API that implements DefaultApi10a
and points to our endpoint. I set up the service like so:
final OAuth10aService service = new ServiceBuilder()
.apiKey("key")
.apiSecret("secret")
.build(TestApi.instance());
This didn't work. After doing a bunch of digging, it appears that because we're using a self-signed certificate I'm not able to get to the remote host. I was getting an error saying that there was a problem connecting to the remote service. ScribeJava appears to not have a way to disable the verification of using a self-signed certificate.
Since we want to be able to authenticate using the authorization header on the request, how would I go about generating just the header portion with a Java library? I've looked all around and couldn't find anything.
For reference, we have successfully made good Oauth REST calls using Python with something simple like this:
headeroauth = OAuth1(Oauth1Key, Oauth1Secret,
signature_type='auth_header')
myResponse = requests.get("endpoint_here", auth=headeroauth, verify=False)
Any input on how to accomplish somewhat of the same thing using Java?