A Java library for building OAuth1 authorization headers.
Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.renefatuaki</groupId>
<artifactId>oauth1-authorization-header-builder</artifactId>
<version>1.0.0</version>
</dependency>Alternatively, you can pull it from the central Maven repositories: Maven Central Repository
Creating an OAuth1 Authorization Header for Twitter media upload endpoint:
String authorization = new OAuth1AuthorizationHeaderBuilder()
.setHttpMethod("POST")
.setUrl("https://upload.twitter.com/1.1/media/upload.json")
.setConsumerSecret(consumerSecret)
.setTokenSecret(accessTokenSecret)
.addParameter("oauth_consumer_key", consumerKey)
.addParameter("oauth_token", accessToken)
.addQueryParameter("additional_owners=" + id)
.build();This code is licensed under the Apache License v2.