0

I'm giving the user the opportunity to log in via OAuth and the Twitter JavaScript api and I would like to display all of the users tweets. I can't find an equivalent to Facebooks FB.api('/me/feed') in the documentation to @Anywhere.

KARTHIKEYAN.A
  • 18,210
  • 6
  • 124
  • 133
johnny
  • 8,696
  • 6
  • 25
  • 36

1 Answers1

1

@Anywhere propagates a logged in user object.

When the user is connected the currentUser property can be used to retrieve information about the logged-in user. The user object has a data method that can be passed a string representing the property to retrieve.

Here you can query for an ID which you can pass on to the REST API

<span id="twitter-connect-placeholder"></span>
<script type="text/javascript">

  twttr.anywhere(function (T) {

    var currentUser,
        screenName;

    if (T.isConnected()) {
      currentUser = T.currentUser;
      screenName = currentUser.data('screen_name');
      $.getJSON('http://api.twitter.com/1/users/show.json?callback=?',
      {
      screen_name: screenName //pass @Anywhere screenname here
  },
 function (data) {
      console.log(data.status); //get last tweet from the user
  });    
    }

  });

</script>
Chamilyan
  • 9,347
  • 10
  • 38
  • 67