How to detect logged user?


What I’m trying to do is use the “following button” as an entry point, so what I need is to know the current user to figure out if it is following me or not. I don’t need oauth_token just to know the name of the logged in user if it exists.

If user is logged in and following me the “following button” is gray, it’s just what I need to know, with a javascript code.

Thanks and regards,


We don’t expose the idenity nor the following status of the current user on your site when you’re implementing the follow button. Essentially, you have no way of knowing whether the user visiting your site is a user of Twitter or not, much less whether they are following the account in question.

The closest you can get is triggering the javascript event on the competition of a follow action, but that will still be without personally identifiable information of the logged in user.


hmmm, but here are you not exposing information about following relationship? (

I don’t need the identity of twitter user, I just want to know if the user already is following me or not, just like ‘following button’ does to figure out if it’s gray or activate.

I thought that I gonna need the user name to check if it was following me or not. Could you explain me a little better or where I could read about “trigger javascript event on the competition of a follow action”? seems that is what I need given that I no need identify personally users, I just need to know if they are following the user.



There’s a difference between making an API call regarding two arbitrary accounts and making an API call to determine information about the current user using your site…

Whether the follow button has detected if the current user is following the user indicated in the follow button is simply undisclosed. You can learn whether the user followed the user in question as a result of using the follow button on your page using [node:184], but you won’t know how many users, if any, were already following the account in question upon arrival.