Oops, I got the wrong communication dump^^ Sorry about that, the issue
is not on the authorization step, but on the access token step :p

Ok, so using the https://api.twitter.com/oauth/* urls, here is what
happens :

I get the request token, no problem

I open the web browser on the authorization page, everything is still
perfect
After the user allows my application to access his data, i'm
redirected to this URI : sociallib://twitter => this is so I am
redirected to my application, rather than staying on the web browser
view

So i'm back in my application context, and i try to retrieve the
access token with my request token and verifier.

I should be receiving a response with a string like this one :

oauth_token=myTokenAccessString&oauth_token_secret=MySecretString&user_id=123456&screen_name=somebody

And this is the string i receive when i run my program on an android
emulator, so I can retrieve the access token and secret!

But when I run the same application on actual android devices, I do
not receive that string as a response when i try to get my access
token!
What I receive is HTML code : <html><body>You are being <a
href="http://
mobile.twitter.com">redirected</a>.</body></html>

So I can't get my access token and secret. So maybe I did something
wrong (and if you think so, I will post you a very detailed step-by-
step guide of what I do, including base strings, and complete
communication dump, just tell me what you need :) ), but maybe it is a
server side issue. Maybe the server who is in charge of sending the
access token is configured so that is sends this html code to "mobile
phones", and that would mean that your server is not compatible with
some mobile devices.

Here is the HTTP request that the application sends :

POST /oauth/access_token HTTP/1.1

User-Agent: Java0

Host: api.twitter.com

Connection: Keep-Alive

Content-Type: application/x-www-form-urlencoded

authorization: OAuth oauth_consumer_key="myConsumerKey",
oauth_nonce="388ed89f6fb14fecf7981b2afa2cf793",
oauth_signature="dLtMBsQaEabtPrHd20xm280j9ug%3D",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1279214023",
oauth_token="someTokenString",
oauth_verifier="zxdzs62RWnINIgl1xdXKbxd3LXAoDJYJrmXvvkV4kcU",
oauth_version="1.0"

content-length: 0

The weird thing is that the exact same code runs flawlessly on an
android emulator and not on android phones. Or maybe there is
something I'm missing.

We are very exited about adding twitter features to our program, so I
hope I will figure this out asap!

Thanks again for helping me!

On 15 juil, 16:27, Taylor Singletary <taylorsinglet...@twitter.com>
wrote:
> You should be consistently usinghttps://api.twitter.com/oauth/*for the
> paths -- are you being automatically redirected to 
> thehttp://m.twitter.comsubdomainor did you manually change your
> configuration to go to that
> instead?
>
> When you say it "goes wrong" -- what is the behavior you are observing? The
> calls for request_token and access_token should be made using a standard
> HTTP library for your programming environment, but the authorize page should
> be loaded in a web browser.
>
> We shouldn't have any issue with your custom URI scheme on the request_token
> step.
>
> Do you know if your device's clock is set correctly?
>
> Thanks,
> Taylor
>
> On Thu, Jul 15, 2010 at 12:21 AM, Mounir Regragui <reg.mou...@gmail.com>wrote:
>
> > Hello Taylor,
>
> > Thank you for helping me.
> > I tried with these endpoints:
> >https://api.twitter.com/oauth/request_token
> >https://api.twitter.com/oauth/access_token
> >https://api.twitter.com/oauth/authorize
>
> > DO work ont the emulator, doesn't on actual devices (tested on 5
> > different android devices)
>
> > Then i tried with these:
> >http://m.twitter.com/oauth/request_token
> >http://m.twitter.com/oauth/access_token
> >http://m.twitter.com/oauth/authorize
>
> > Same thing, do work on the emulator, does not on actual devices.
>
> > Here is a dump (header + string ^^) of the communication from the
> > emulator:
>
> > POST /oauth/request_token HTTP/1.1
>
> > User-Agent: Java0
>
> > Host: m.twitter.com
>
> > Connection: Keep-Alive
>
> > Content-Type: application/x-www-form-urlencoded
>
> > authorization: OAuth oauth_callback="sociallib%3A%2F%2Freviens",
> > oauth_consumer_key="mykey",
> > oauth_nonce="9c4001db102cfa150385c1e037bbef25",
> > oauth_signature="k6azYrtyuhP3LrM6oRvlI7ixK7A%3D",
> > oauth_signature_method="HMAC-SHA1", oauth_timestamp="1279177551",
> > oauth_version="1.0"
>
> > content-length: 0
>
> > I'm afraid this has something to do with a twitter server filtering
> > some user agents or because of my callback URI : sociallib://twitter
>
> > I can't see other reasons why it is working flawlessly on the emulator
> > and not on actual devices.
>
> > If you need more details about what I'm doing, please feel free to
> > ask.
>
> > Thanks again for helping me!
>
> > Mounir.
>
> > On 14 juil, 22:17, Taylor Singletary <taylorsinglet...@twitter.com>
> > wrote:
> > > Hi Mounir,
>
> > > Can you detail step-by-step the full URLs and OAuth headers/query string
> > > parameters you are using throughout these steps? This should all be
> > > consistently achievable if you're using all the right end points.
>
> > > Taylor
>
> > > On Tue, Jul 13, 2010 at 1:46 AM, Mounir Regragui <reg.mou...@gmail.com
> > >wrote:
>
> > > > Hello everybody!
>
> > > > So I'm developping an application on Android that will include some
> > > > Twitter features.
> > > > But I have some trouble retrieving the requestToken on OAuth.
>
> > > > Everything works just fine on the emulator, but on actual devices I
> > > > can't retrieve the requestToken for a simple reason.
>
> > > > From the emulator, I get my response containing the requestToken and
> > > > the secret, so I can fetch these informations.
>
> > > > But on actual devices, I do not receive the string containing the
> > > > secret and token, but i get a HTML page, redirecting me to
> > > > m.twitter.com : <html><body>You are being <a href="http://
> > > > mobile.twitter.com">redirected</a>.</body></html>
>
> > > > I really need not to be redirected to get my informations, as I'm not
> > > > running the request token process from a browser, but from and android
> > > > application. Plus, the redirection to mobile.twitter.com is really NOT
> > > > what I'm trying to achieve ^^
>
> > > > Any thoughts. I'd be grateful if someone could help me.
>
> > > > If you need additional informations, please feel free to ask.

Reply via email to