Skip to content

Java 8 - Minimal library (no dependencies) to create OAuth-1.0a signatures, independent to any HTTP client framework.

License

Notifications You must be signed in to change notification settings

giordamauro/oauth1-signature-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oauth1-signature-builder

Java 8 minimal library to create tailor-made OAuth-1.0a signatures (weights 24.5 KB)

    public static void main(String[] args) {

		OAuthConfig oauthConfig = new OAuthConfigBuilder("myApiKey", "myApiSecret")
				.setTokenKeys("myAccessKey", "myAccessSecret")
				.build();

		OAuthSignature signature = oauthConfig.buildSignature(HttpMethod.GET, "http://serviceUrl")
				.addQueryParam("aParam", "aValue")
				.addFormUrlEncodedParam("myParam", "anotherValue")
				.create();

		System.out.println(signature.getAsHeader());
    }

This code will generate the value for a ready-to-be-used "Authorization" Header:

	
	Authorization:	OAuth oauth_nonce="1906386233", oauth_signature="sQYmuXQV2ROJS3ukvpeaNNl2Jp8=", oauth_token="myAccessKey", oauth_consumer_key="myApiKey", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1461291933"

About

Java 8 - Minimal library (no dependencies) to create OAuth-1.0a signatures, independent to any HTTP client framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages