3

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!

3
  • which javascript library are you using? Commented Nov 4, 2010 at 23:09
  • not using any library... vanilla javascript in appcelerator's titanium mobile to build an iPad app. Commented Nov 4, 2010 at 23:50
  • here is the Titanium api for request headers developer.appcelerator.com/apidoc/mobile/latest/… Commented Nov 5, 2010 at 0:00

1 Answer 1

2

Use the OAuth javascript library. It's setup to build those signed OAuth headers for you...

http://oauth.googlecode.com/svn/code/javascript/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.