# Google Data APIs Client Library (1.43.0)

## com.google.gdata.client.authn.oauth
Class TwoLeggedOAuthHelper

    java.lang.Object
      com.google.gdata.client.authn.oauth.TwoLeggedOAuthHelper

    public class TwoLeggedOAuthHelper

extends java.lang.Object

Provides common OAuth message signing and Authorization header functionality.

Constructor Summary
`TwoLeggedOAuthHelper(OAuthSigner signer, OAuthParameters parameters)`

Method Summary
`java.lang.String` `getAuthorizationHeader(java.lang.String requestUrl, java.lang.String httpMethod)` Generates the string to be used as the HTTP authorization header.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TwoLeggedOAuthHelper

    public TwoLeggedOAuthHelper(OAuthSigner signer,
                                OAuthParameters parameters)

Method Detail

### getAuthorizationHeader

    public java.lang.String getAuthorizationHeader(java.lang.String requestUrl,
                                                   java.lang.String httpMethod)
                                            throws OAuthException

  Generates the string to be used as the HTTP authorization header. A typical authorization header will look something like this:

  OAuth realm="", oauth_signature="SOME_LONG_STRING", oauth_nonce="123456", oauth_signature_method="RSA-SHA1", oauth_consumer_key="www.example.com", oauth_token="abc123", oauth_timestamp="123456"

  The following parameters are required in `OAuthParameters`:

  - oauth_consumer_key
  - oauth_token
  - oauth_token_secret (if signing with HMAC)

  Parameters:
    `requestUrl` - the url of the request
    `httpMethod` - the http method of the request (for example GET)
  Returns:
    the full authorization header
  Throws:
    `OAuthException` - if there is an error with the OAuth request
  See Also:
    OAuth Authorization Header