I found a solution for myself: consider the application as a web application, and not a mobile application consisting of 3 parts: a Facebook / Twitter server, my own application (Apache / PHP) and a browser (web presentation on a mobile device). With this architecture: my own application server is responsible for authentication and other tasks (wall to wall), it stores appId, Secret application and userToken, all the information, it connects directly to the Facebook / Twitter server; the mobile device has a role only as a browser agent, it only displays a web view pointing to a link belonging to my server, it does not store any information.
Consider these two Facebook and Twitter authentication documents for a web application for more details:
http://developers.facebook.com/docs/guides/web/#login view Authentication Section
https://dev.twitter.com/docs/auth/oauth
source share