[twitter-dev] Incorrect signature with oAuth

2010-07-17 Thread CeBeans
Im developing a DLL in eVC++3.0 (native C++) that uses the Twitter
oAuth to update a status and have searched the web and support
websites for over a week but still cant figure the signature problem
out.


NOTE: I have deleted the app in this example so Its safe to give out
the correct codes.  This way I can get a better response from support.


The DLL is a simple call to update a users status: status=h (to get
this thing started)

My DELETED App Info:
ConsumerKey,x80ZNISjmQ0Lxufp0QVM6w
ConsumerSecret,AHumtKUplfkqJVVy0VtbjoMROMU1SoVbCI8aIubu2Nc
Token,63573892-Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK
TokenSecret,6lRq2U4UoO3pv1Z0odU4lxhXvc3zlwJdOuyViQx44


Signature Base:
POSThttp%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
%2Fupdate.xmloauth_consumer_key%3Dx80ZNISjmQ0Lxufp0QVM6w%26oauth_nonce
%3D4064976171056201%26oauth_signature_method%3DHMAC-
SHA1%26oauth_timestamp%3D1279378609%26oauth_token%3D63573892-
Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK%26oauth_version
%3D1.0%26status%3Dh

Signature Key to Sign with:
AHumtKUplfkqJVVy0VtbjoMROMU1SoVbCI8aIubu2Nc6lRq2U4UoO3pv1Z0odU4lxhXvc3zlwJdOuyViQx44

http Header:
=
Authorization: OAuth oauth_nonce=4064976171056201,
oauth_signature_method=HMAC-SHA1, oauth_timestamp=1279378609,
oauth_consumer_key=x80ZNISjmQ0Lxufp0QVM6w, oauth_token=63573892-
Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK,
oauth_signature=ZztcjuTr1oxmVpQPAltfxiUEwEw%3D, oauth_version=1.0
Content-Type: application/x-www-form-urlencoded
Host: api.twitter.com
Content-Length: 10
Connection: Keep-Alive

Http Footer
=
status%3Dh

Server Response
==
?xml version=1.0 encoding=UTF-8?
hash
  request/1/statuses/update.xml/request
  errorIncorrect signature/error
/hash

I also tried the HTTPS in the signature base, and still the same
error.  NOTE: The DLL calls
http://api.twitter.com/1/statuses/update.xml


Vincent Collura
CeBeans



[twitter-dev] Re: Incorrect signature with oAuth

2010-07-18 Thread CeBeans
Hi Carlos:

It works!!! Thanks for the tips.

I set the header to the one one the GoogleCode page.  I also removed
the spaces in the header.
I was getting the same signature as the GoogleGode page (Im using pure
C++ here so I have a set of libs for SHA/Base64) so there was some
concern.

While C++ shotguning I tried to update status with the footer line:

status=woowow

AND IT WORKS!

NOTE: As you can see the footer is NOT url encoded.   I think what
Twitter wants is all of the characters AFTER the 'status=' to be url
encoded.  NOT the 'status='

Time for the C++ dance,

Thanks Carlos!

Vincent Collura
(Inventor/Engineer)

http://www.CeBeans.com
Did you get your beans Today?


On Jul 18, 12:54 am, Carlos carlosju...@gmail.com wrote:
 Don't know if it matters but you are adding a space after each comma
 in the Authorization Header.

 Also check your signature generation method using the 
 following:http://oauth.googlecode.com/svn/code/javascript/example/signature.html
 and see if you are getting the same signature values.

 On Jul 17, 5:21 pm, CeBeans inven...@cebeans.com wrote:

  Hi Carlos:

  Thanks for the sniplet. I just converted my source to encode when
  *building* the parameter string and encode again when *adding* it.  I
  tried on my proper app token codes and still signature error.

  This is with my base looks like now.  NOTE: I changed the C++ source
  back to the older tokens for this report since this is a public
  newsgroup.  I kept the new 'dual' encoding in the source:

  According to your pseudo code, my base is now:

  POSThttp%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
  %2Fupdate.xmloauth_consumer_key%3Dx80ZNISjmQ0Lxufp0QVM6w%26oauth_nonce
  %3D622476171724201%26oauth_signature_method%3DHMAC-
  SHA1%26oauth_timestamp%3D1279401864%26oauth_token%3D63573892-
  Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK%26oauth_version
  %3D1.0%26status%3Dh

  I did try to urlencode the status parameter, just to see but changed
  it back to above.

  And the new HTTP header (with signature):

  Authorization: OAuth oauth_nonce=622476171724201,
  oauth_signature_method=HMAC-SHA1, oauth_timestamp=1279401864,
  oauth_consumer_key=x80ZNISjmQ0Lxufp0QVM6w, oauth_token=63573892-
  Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK,
  oauth_signature=nEOZNjNS0uyh58XzR2QH%2FPLK%2F7k%3D,
  oauth_version=1.0
  Content-Type: application/x-www-form-urlencoded
  Host: api.twitter.com
  Content-Length: 10
  Connection: Keep-Alive

  What am I missing?

  Vincent Collura
  CeBeans

  On Jul 17, 1:53 pm, Carlos carlosju...@gmail.com wrote:

   Are you doing this in PseudoCode?

   base = methodURLEncode(endpoint)URLEncode(URLParameterString)
   where URLParameterString =
   URLEncode(name)=URLEncode(value)URLEncode(name)=URLEncode(value)...

   On Jul 17, 11:01 am, CeBeans inven...@cebeans.com wrote:

Im developing a DLL in eVC++3.0 (native C++) that uses the Twitter
oAuth to update a status and have searched the web and support
websites for over a week but still cant figure the signature problem
out.


NOTE: I have deleted the app in this example so Its safe to give out
the correct codes.  This way I can get a better response from support.


The DLL is a simple call to update a users status: status=h (to get
this thing started)

My DELETED App Info:
ConsumerKey,x80ZNISjmQ0Lxufp0QVM6w
ConsumerSecret,AHumtKUplfkqJVVy0VtbjoMROMU1SoVbCI8aIubu2Nc
Token,63573892-Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK
TokenSecret,6lRq2U4UoO3pv1Z0odU4lxhXvc3zlwJdOuyViQx44

Signature Base:
POSThttp%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
%2Fupdate.xmloauth_consumer_key%3Dx80ZNISjmQ0Lxufp0QVM6w%26oauth_nonce
%3D4064976171056201%26oauth_signature_method%3DHMAC-
SHA1%26oauth_timestamp%3D1279378609%26oauth_token%3D63573892-
Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK%26oauth_version
%3D1.0%26status%3Dh

Signature Key to Sign with:
AHumtKUplfkqJVVy0VtbjoMROMU1SoVbCI8aIubu2Nc6lRq2U4UoO3pv1Z0odU4lxhXvc3zlwJdOuyViQx44

http Header:
=
Authorization: OAuth oauth_nonce=4064976171056201,
oauth_signature_method=HMAC-SHA1, oauth_timestamp=1279378609,
oauth_consumer_key=x80ZNISjmQ0Lxufp0QVM6w, oauth_token=63573892-
Y5GT47cl6ixaRKTaK5TpDg9N9D6g5Wqy718pIydjK,
oauth_signature=ZztcjuTr1oxmVpQPAltfxiUEwEw%3D, oauth_version=1.0
Content-Type: application/x-www-form-urlencoded
Host: api.twitter.com
Content-Length: 10
Connection: Keep-Alive

Http Footer
=
status%3Dh

Server Response
==
?xml version=1.0 encoding=UTF-8?
hash
  request/1/statuses/update.xml/request
  errorIncorrect signature/error
/hash

I also tried the HTTPS in the signature base, and still the same
error.  NOTE: The DLL callshttp://api.twitter.com