Skip to main content
chregano
Participant
January 20, 2015
Question

Twitter OAuth issue on Flex

  • January 20, 2015
  • 1 reply
  • 492 views

Hey

I am trying to allow user to login using Twitter on an Adobe Air/Flex mobile app.

I open a StageWebView browser and point it to:

https://api.twitter.com/oauth/authenticate?oauth_token=XXX

If the user logs in successfully on the first attempt, it redirects to:

https://twitter.com/intent/sessions

and freezes there.

The very very strange thing, is that if the user enters the incorrect login details, and then enters the correct details on the second/third attempt, it redirects successfully and everything works as expected.

Any help or guidance would be massively appreciated.

thanks very much!

This topic has been closed for replies.

1 reply

Frédéric C.
Inspiring
February 1, 2015

Same issue here with latest AIR 16 beta.

After further investigation, it seems to be related to the internal webkit engine used by AIR (maybe a specific user agent that is not properly handled by Twitter?). You can provide an extra parameter to your StageWebView (set to TRUE), that will then force your app to use the native browser. For me it then uses the IE11 engine (on Windows), and it works (the CSS doesn't seem to be loaded though, giving a really ugly login page).

For me it is really a showstopper issue, as any AIR app behaving as a twitter interface will probably encounter the same issues... Any idea on how to fix this without having a messed up login page, please?

Frédéric C.
Inspiring
February 3, 2015

Hi,

I think I found a workaround that works pretty well. I think that Twitter  has some issues when it tries to both authenticate a user and authorize an app at the same time. So I split the process into 2 steps, and it seems to work.

1) First I call the login page, like this ""https://twitter.com/login?redirect_after_login=XYZ" (where XYZ is an existing URL where the StageWebView will be redirected to once the user in logged in)

2) I wait for the StageWebView to be redirected to this XYZ URL, and at this point, I'm sure the user is logged in, and that Twitter created the proper session

3) Then I call the authorization request, which is only dedicated to authorizing the app (and not identifying the user at the same time, since it was already logged in a few seconds ago).

Works like a charm for me. I hope it will help!

Frédéric