Reputation: 31
I'm using oauth in an API library and the API requires that the Authorization header be explicitly set for each request.
I'm familiar with the setRequestHeader method, using it like:
this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
However, I'm not sure how to properly set the Authorization header, since it has so many parameters. An example of what the header needs to look like is:
Authorization: OAuth realm="",oauth_version="1.0",oauth_consumer_key="consumer",oauth_token="foo",oauth_timestamp="timestamp",oauth_nonce="ononce",oauth_signature_method="PLAINTEXT",oauth_signature="osig"
How do I properly set the Authorization header in this format using setRequestHeader? Thanks!
Upvotes: 3
Views: 8706
Reputation: 81
Use the OAuth javascript library. It's setup to build those signed OAuth headers for you...
http://oauth.googlecode.com/svn/code/javascript/
Upvotes: 2