Without looking to deeply yet (sorry, on vacation!) it appears you are
over encoding values in your signature basestring.. For example,
underscores are not protected characters and need not be encoded. I
recommend reviewing the OAuth spec regarding encoding characters and
ensure your encoder follows those rules.

Taylor

On Monday, September 6, 2010, Garry <taylor.ga...@gmail.com> wrote:
> OK, I'm trying to send my first xAuth request, but I'm getting "401
> Unauthorized". Here is the base string I am signing:
>
> POST%26https%3A%2F%2Fapi%2Etwitter%2Ecom%2Foauth%2Faccess%5Ftoken
> %26oauth%5Fconsumer%5Fkey%3Dwd0fPXXXXXXX9m9O7OYRg%26oauth%5Fnonce
> %3DAZWKFccT4qryy4LJDJMZbwNCHXwrbhsqft3e5ixz0sKGsCHcUq%26oauth
> %5Fsignature%5Fmethod%3DHMAC%2DSHA1%26oauth%5Ftimestamp
> %3D1283791832%26oauth%5Fversion%3D1%2E0%26x%5Fauth%5Fmode%3Dclient
> %5Fauth%26x%5Fauth%5Fpassword%3DXXXXXX%26x%5Fauth%5Fusername
> %3Dgarrytaylor
>
> And here is my full POST request:
>
> POST /oauth/access_token HTTP/1.1
> Host: api.twitter.com
> User-Agent: SNDTWEET
> Connection: close
> Content-Length: 74
> Authorization: OAuth realm="",
> oauth_nonce="AZWKFccT4qryy4LJDJMZbwNCHXwrbhsqft3e5ixz0sKGsCHcUq",
> oauth_signature_method="HMAC-SHA1", oauth_timestamp="1283791832",
> oauth_consumer_key="wd0fPXXXXXXX9m9O7OYRg",
> oauth_signature="XjbVbryI8WQDIpuZlZbl7iwDHNc%3D", oauth_version="1.0"
> Content-Type: application/x-www-form-urlencoded
>
> x_auth_mode=client_auth&x_auth_password=XXXXXX&x_auth_username=garrytaylor
>
> I've used XXX in some places for security reasons. Is there anything
> that look immediately wrong here?
>
> Thanks a lot
>
> Garry
>
> --
> Twitter developer documentation and resources: http://dev.twitter.com/doc
> API updates via Twitter: http://twitter.com/twitterapi
> Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
> Change your membership to this group: 
> http://groups.google.com/group/twitter-development-talk?hl=en
>

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk?hl=en

Reply via email to