How do I keep track of users who log into my site with "Sign in With Twitter"?


I have a fair understanding of how to implement the OAuth protocol and how it works with the user experience and user flow. However, after all the authentication and granting of access to my application is done and complete, what can I store about the user within my application database? For example, some of my application’s functions require a user’s email address. So, can I store a user’s registered twitter email address in my application’s database? If not, do I have to hit up Twitter’s API each time I want that email address? If that is the case, won’t I need to store some type of identifier in my database for users who logged in with the Twitter API? What identification information can I store within my own database?

Any pointers, tips, or suggestions to help me with this question are greatly appreciated!

Thank you for your time and help.


If you’re using the oauth/authenticate end point and you don’t have an internal representation of user within your own app (in that your users don’t have their own login and password), I would recommend using the Twitter user’s user ID as they key representing that user. Screen names can change, as can the string used in access tokens and access token secrets, but the user id is something that will persist.

Twitter’s API and OAuth don’t return a user’s email address to you. If you need a user’s email address, you’ll have to ask for it from them directly.

There are few restrictions really on storing information about a user who has authorized your app to act on their behalf, keeping in mind that surprising users is never a good thing.


do twitter provides stats to check how many user logged in using twitter API ?


No, we do not provide stats like that at this time. You would have to track them yourself.


thanks for your reply…or is it possible through google analytics…?