OAuth, PyS60 and Twitter: now working !

by Marcelo Barros

Since August 31th Twitter is not supporting the old user/password authentication scheme anymore and I had to study how to use OAuth for authenticating Wordmobi users.

Basically, after registering your application at Twitter site you receive a key and a secret. Using these information, a special authentication URL is created and users need to type it in the browser and login using their twitter credentials. After logging in, a PIN number is generated by Twitter. Finally, an authentication token is generated using this PIN number and the key of your application. Further accesses may be performed only using this token and your application key.

There are other ways to use OAuth but the proposed method (PIN based) is suitable for PyS60 applications. In the current demo, a temporary page is created showing the target link and users need to click on it. Moreover, it is necessary to write down the presented PIN number. After closing the browser, this PIN number can be typed using a query dialog and the authentication token is saved for further accesses.

I just finished my first demo application, it is far from perfect but I would like to share this result with our readers. You need to install Python 2.0 for Symbian, ssl.sis and pips.sis, all included in the standard PyS60 distribution. Do not forget to type your key and secret at the end of demo.py file.

Enjoy ! Source code is here. I used Leah’s Python OAuth.

Redirecting to twitterLogging in TwitterPIN numberTyping PIN number

Related posts:

  1. Network programming for PyS60 (X) To celebrate our tenth post, I will talk about urllib...
  2. Working with math sets using Python I always try to bring what I learn into programming,...
  3. Network programming for PyS60 (XVI) Qik is a new and innovative service that allows you...

Related posts brought to you by Yet Another Related Posts Plugin.