简体   繁体   中英

Angularjs using OAuth to access most recent tweet

I am trying to add a users most recent tweet next to there name in my current app. however I am having a lot of trouble setting up my authentication with OAuth and twitter.

So far I have followed all of the instructions on the OAuth.io website and setup both a twitter dev account and my OAuth.io account.

However when I try to implement the code they suggest to use, I get a very quick popup and then it immediately closes.

      OAuth.initialize('SYd6rvZZTLQT-oJxWOeNctFuUyA');
//Using popup
OAuth.popup('twitter', function(error, result) {
  //handle error with errorconsole.log
  result.get('/1.1/account/verify_credentials.json')
  (" " + JSON.stringify(result, null, 2));
  //use result.access_token in your API request
  (" " + JSON.stringify(error, null, 2));

});

any suggestions?

Ideally I would simply use this jsfiddle http://jsfiddle.net/thyb/kZExJ/5/light/ but with its use of handlebars im lost.

I'm silly and screwed up

    $scope.twitter = function (){ 
     OAuth.initialize('SYd6rvZZTLQT-oJxWOeNctFuUyA');
//Using popup (option 1)
OAuth.popup('twitter', function(error, result) {
  //handle error with errorconsole.log
 // result.get('/1.1/account/verify_credentials.json')
  (" " + JSON.stringify(result, null, 2));
  //use result.access_token in your API request
  (" " + JSON.stringify(error, null, 2));
  if (error) return alert(error);
});}

works, but I am now having trouble understanding how to get an individual twitter accounts most recent tweet. how do I query the twitter api and return that information?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM