[twitter-dev] Re: Does “~” need encode?

2011-06-17 Thread Felix Oldenburg
I had the same issue with the ~ encoding. If ~ gets encoded to %7E the
signature is wrong, but with a plain ~ it's fine.

But if u look at abraham's php twitter library, which also implements
the needed oauth functionality, u can see he also uses the non encoded
~.
( https://github.com/abraham/twitteroauth )

This is his url encoding method:
(See OAuth.h in the OAuthUtil class)

public static function urlencode_rfc3986($input) {
  if (is_array($input)) {
return array_map(array('OAuthUtil', 'urlencode_rfc3986'), $input);
  } else if (is_scalar($input)) {
return str_replace(
  '+',
  ' ',
  str_replace('%7E', '~', rawurlencode($input))
);
  } else {
return '';
  }

As one can see, the %7E gets decoded back to ~.
Maybe RFC3986 is worth a look.

On 17 Jun., 12:36, kamesh SmartDude kamesh.smartd...@gmail.com
wrote:
 There might be some other problem in u r signature generation.

 but not about the ~ url encoding.

 //kamesh







 On Fri, Jun 17, 2011 at 1:57 PM, LoVenus pzunderta...@hotmail.com wrote:
  Thank you for your reply.

  But as I said, if encode ~, signature will be wrong.

  --
  Twitter developer documentation and resources:https://dev.twitter.com/doc
  API updates via Twitter:https://twitter.com/twitterapi
  Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
  Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: oauth_bridge_code Disabled?

2011-06-16 Thread Felix Oldenburg
Hi DustyReagan,

we had this topic lately, see this thread:
http://groups.google.com/group/twitter-development-talk/browse_frm/thread/50fcc4f28cd6b659


On 16 Jun., 00:26, DustyReagan dustyrea...@gmail.com wrote:
 Was oauth_bridge_code disabled? If so how are we suppost to bridge
 @anywhere OAuth logins to the REST API?

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Randomly failing OAuth procedure

2011-06-15 Thread Felix Oldenburg
Hi Taylor,

after doing some more detailed logging, i managed to figure out the
problem.

First I do the encoding of the post body, then the signature is being
build and attached to the post body.
I just forgot to encode the signature string, too, after attaching it
to the post body.
So everytime when the signature strings contained a slash or an equal
sign, like base64 tends to produce, the oauth failed.

Besides the encoding of the status texts was wrong. Just as I saw in
Abraham's Twitter PHP library I decoded %7E back to ~ in the final
string and oauth is happy. Otherwise, if the string contains a plain ~
it fails, still wondering why...

Thanks again for the support and sunny greetings from Hamburg Germany,
Felix.


On 14 Jun., 18:03, Felix Oldenburg oldenburg.fe...@googlemail.com
wrote:
 Hi Taylor,

 thanks for many hints on tracking down the problem.
 I don't use any libraries, neither for Twitter, nor for oauth. I'm
 doing all by my self, thus printing out some debugging messages is
 fairly easy.
 As I'm able to do a status update some times successfully, I was sure
 to do everything correctly.
 Of cource, I inspected every detail, like the assembling of the base
 string and its signing.
 I followedhttp://dev.twitter.com/pages/authand I get the same
 results for the base string and the final signature string, when I use
 the same input as in the example.
 Even using special characters(space, exclamation mark, and so on..) in
 the text of the tweet is possible, as I already tweeted some cryptic
 posts - containing different special chars - to my wall.
 So I pressume my url encoding and signing process should be correct.

 https://api.twitter.com/oauth/request_tokenandhttps://api.twitter.com/oauth/access_token
 are the paths I use for acquiring the request and access token.

 The system clock of my Macbook is fine, I think, but I'll check that
 out on detail.
 Maybe I should recheck my timestamp and oauth_nonce generation code,
 because I don't check if a timestamp, or oauth_nonce is being used
 twice. Though I can't imagine what could go wrong, when simply using a
 unix timestamp.
 (Oh.. is it seconds or miliseconds ruby returns when using
 Time.now.to_i, I'd better check that out oO!!!)

 I'll check the timestamp thing and if that's not the problem, I'll
 post some detailed debug report tomorrow.

 Many thanks for your inspiring reply, Felix!

 On 14 Jun., 17:10, Taylor Singletary taylorsinglet...@twitter.com
 wrote:







  Hi Felix,

  Are you using a specific OAuth library for the OAuth portion?

  I would recommend adding a bit of logging around the OAuth token negotiation
  process.. find out the signature base string, the exact URL you're
  executing, and the Authorization header you're sending. Log the response
  code and body of the response when it fails. With the main OAuth ruby gem
  that's out there, some of these details are hard to come by because the
  values are hidden in private methods (PSA to OAuth library developers: don't
  do this), so you may need to monkey patch the OAuth gem here and there to
  debug the values.

  What you're mainly looking for is a specific pattern to your failed requests
  for a request token -- is some value not being sent correctly? Do you have
  some kind of problem where in certain conditions a variable you've set like
  your consumer key gets unset somehow? Is your system clock reliable? Is the
  library you're using to generate HMAC-SHA1 signatures doing the right thing?
  Are you using the right kind of URL encoding? Are you accidentally sending
  double parameters for something?

  Verify that you're usinghttps://api.twitter.com/oauth/asthe base path for
  the OAuth negotiation steps.

  While there have been failures in the past in exchanging a request token for
  an access token due to some lag, we're not aware of
  anything specifically wrong with the process for fetching the request token.

  @episod http://twitter.com/intent/user?screen_name=episod - Taylor
  Singletary

  On Tue, Jun 14, 2011 at 7:25 AM, Felix Oldenburg 

  oldenburg.fe...@googlemail.com wrote:
   Hi twitter developing community,
   I'm using ruby( on rails) to do the oauth dance manually and finally
   call /1/statuses/update.json to update the status of an authorized
   user.

   Every single step during the oauth procedure is confirmed to be
   working.
   Actually I already tweeted some messages successfully. But for no
   obvious reason(to me), oauth sometimes fails at the very beginning
   while acquiring a request token. Then it just sais: Failed to
   validate oauth signature and token.

   Then I retry it several times until it (suddenly) works.
   The next step, i.e. exchanging the request token for an access token,
   works perfectly every time.
   But when it comes to the actual status update(i.e. calling the /1/
   statuses/update.json endpoint) it sometimes fails, too, saying Failed
   to validate oauth signature and token.

   Again I just retry a few times

[twitter-dev] Randomly failing OAuth procedure

2011-06-14 Thread Felix Oldenburg
Hi twitter developing community,
I'm using ruby( on rails) to do the oauth dance manually and finally
call /1/statuses/update.json to update the status of an authorized
user.

Every single step during the oauth procedure is confirmed to be
working.
Actually I already tweeted some messages successfully. But for no
obvious reason(to me), oauth sometimes fails at the very beginning
while acquiring a request token. Then it just sais: Failed to
validate oauth signature and token.

Then I retry it several times until it (suddenly) works.
The next step, i.e. exchanging the request token for an access token,
works perfectly every time.
But when it comes to the actual status update(i.e. calling the /1/
statuses/update.json endpoint) it sometimes fails, too, saying Failed
to validate oauth signature and token.

Again I just retry a few times and all of a sudden it works.

I don't change the code during this testing sessions, nor do i change
the text I want to be tweetet.
It just doesn't work sometimes.
I can't reproduce this unwanted behavior.

Did Somebody have the same issue?
Suggestions are also appreciated.

Kind regards, Felix.

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Randomly failing OAuth procedure

2011-06-14 Thread Felix Oldenburg
Hi Taylor,

thanks for many hints on tracking down the problem.
I don't use any libraries, neither for Twitter, nor for oauth. I'm
doing all by my self, thus printing out some debugging messages is
fairly easy.
As I'm able to do a status update some times successfully, I was sure
to do everything correctly.
Of cource, I inspected every detail, like the assembling of the base
string and its signing.
I followed http://dev.twitter.com/pages/auth and I get the same
results for the base string and the final signature string, when I use
the same input as in the example.
Even using special characters(space, exclamation mark, and so on..) in
the text of the tweet is possible, as I already tweeted some cryptic
posts - containing different special chars - to my wall.
So I pressume my url encoding and signing process should be correct.

https://api.twitter.com/oauth/request_token and 
https://api.twitter.com/oauth/access_token
are the paths I use for acquiring the request and access token.

The system clock of my Macbook is fine, I think, but I'll check that
out on detail.
Maybe I should recheck my timestamp and oauth_nonce generation code,
because I don't check if a timestamp, or oauth_nonce is being used
twice. Though I can't imagine what could go wrong, when simply using a
unix timestamp.
(Oh.. is it seconds or miliseconds ruby returns when using
Time.now.to_i, I'd better check that out oO!!!)

I'll check the timestamp thing and if that's not the problem, I'll
post some detailed debug report tomorrow.

Many thanks for your inspiring reply, Felix!


On 14 Jun., 17:10, Taylor Singletary taylorsinglet...@twitter.com
wrote:
 Hi Felix,

 Are you using a specific OAuth library for the OAuth portion?

 I would recommend adding a bit of logging around the OAuth token negotiation
 process.. find out the signature base string, the exact URL you're
 executing, and the Authorization header you're sending. Log the response
 code and body of the response when it fails. With the main OAuth ruby gem
 that's out there, some of these details are hard to come by because the
 values are hidden in private methods (PSA to OAuth library developers: don't
 do this), so you may need to monkey patch the OAuth gem here and there to
 debug the values.

 What you're mainly looking for is a specific pattern to your failed requests
 for a request token -- is some value not being sent correctly? Do you have
 some kind of problem where in certain conditions a variable you've set like
 your consumer key gets unset somehow? Is your system clock reliable? Is the
 library you're using to generate HMAC-SHA1 signatures doing the right thing?
 Are you using the right kind of URL encoding? Are you accidentally sending
 double parameters for something?

 Verify that you're usinghttps://api.twitter.com/oauth/as the base path for
 the OAuth negotiation steps.

 While there have been failures in the past in exchanging a request token for
 an access token due to some lag, we're not aware of
 anything specifically wrong with the process for fetching the request token.

 @episod http://twitter.com/intent/user?screen_name=episod - Taylor
 Singletary

 On Tue, Jun 14, 2011 at 7:25 AM, Felix Oldenburg 







 oldenburg.fe...@googlemail.com wrote:
  Hi twitter developing community,
  I'm using ruby( on rails) to do the oauth dance manually and finally
  call /1/statuses/update.json to update the status of an authorized
  user.

  Every single step during the oauth procedure is confirmed to be
  working.
  Actually I already tweeted some messages successfully. But for no
  obvious reason(to me), oauth sometimes fails at the very beginning
  while acquiring a request token. Then it just sais: Failed to
  validate oauth signature and token.

  Then I retry it several times until it (suddenly) works.
  The next step, i.e. exchanging the request token for an access token,
  works perfectly every time.
  But when it comes to the actual status update(i.e. calling the /1/
  statuses/update.json endpoint) it sometimes fails, too, saying Failed
  to validate oauth signature and token.

  Again I just retry a few times and all of a sudden it works.

  I don't change the code during this testing sessions, nor do i change
  the text I want to be tweetet.
  It just doesn't work sometimes.
  I can't reproduce this unwanted behavior.

  Did Somebody have the same issue?
  Suggestions are also appreciated.

  Kind regards, Felix.

  --
  Twitter developer documentation and resources:https://dev.twitter.com/doc
  API updates via Twitter:https://twitter.com/twitterapi
  Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
  Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your

[twitter-dev] Re: Support for oauth_bridge_code via this endpoint is deprecated

2011-06-09 Thread Felix Oldenburg
Hi,
I'm facing the same problem until today.


On 9 Jun., 02:53, bisanthe bisanthe.gro...@gmail.com wrote:
 Hello,
 When I run the following code

                         OAuthRequest request = new OAuthRequest(Verb.POST, 
 https://
 api.twitter.com/oauth/access_token);
                         request.addBodyParameter(oauth_bridge_code, 
 oauth_bridge_code);
                         service.signRequest(token, request);
                         Response response = request.send();

 Following message appears.

 errors
   error code=97Support for oauth_bridge_code via this endpoint is
 deprecated/error
 /errors

 Did something changed in twitter API ? It was working a couple of
 weeks ago ?

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


[twitter-dev] Re: Support for oauth_bridge_code via this endpoint is deprecated

2011-06-09 Thread Felix Oldenburg
Hi,
I'm facing the same problem since today.

Mine was working until today, too :(.
I was just about to finish the project (took me weeks of work) and now
the bridge code conversion is broken aaarghh!

Regards, Felix.

On 9 Jun., 02:53, bisanthe bisanthe.gro...@gmail.com wrote:
 Hello,
 When I run the following code

                         OAuthRequest request = new OAuthRequest(Verb.POST, 
 https://
 api.twitter.com/oauth/access_token);
                         request.addBodyParameter(oauth_bridge_code, 
 oauth_bridge_code);
                         service.signRequest(token, request);
                         Response response = request.send();

 Following message appears.

 errors
   error code=97Support for oauth_bridge_code via this endpoint is
 deprecated/error
 /errors

 Did something changed in twitter API ? It was working a couple of
 weeks ago ?

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: Support for oauth_bridge_code via this endpoint is deprecated

2011-06-09 Thread Felix Oldenburg

Ah, sorry I mean since today...

Am 09.06.11 15:50, schrieb Felix Oldenburg:

Hi,
I'm facing the same problem until today.


On 9 Jun., 02:53, bisanthebisanthe.gro...@gmail.com  wrote:

Hello,
When I run the following code

 OAuthRequest request = new OAuthRequest(Verb.POST, 
https://
api.twitter.com/oauth/access_token);
 request.addBodyParameter(oauth_bridge_code, 
oauth_bridge_code);
 service.signRequest(token, request);
 Response response = request.send();

Following message appears.

errors
   error code=97Support for oauth_bridge_code via this endpoint is
deprecated/error
/errors

Did something changed in twitter API ? It was working a couple of
weeks ago ?


--
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk