Sign-in with twitter using angular

青春壹個敷衍的年華 提交于 2019-11-30 17:27:53

问题


I am trying to implement singin functioanlity using angular2 , Read from official documentation also from here , But didn't get how the flow is going on. my questions are

  1. what are the parameters for accessing first step i.e outh_token ?
  2. is there any working example or best articles which teach the flow ?
  3. I have read number of questions on SO but none of them work for me.

any suggestion will be appreciated.

PS: as of now i am Hitting Post request on this URL

let url = 'http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fgoogle.com%2Ftwittercallback&oauth_consumer_key=my_consumer_key&oauth_nonce=ea9ec8429b68d6b77cd5600adbbb0456&oauth_signature=F1Li3tvehgcraF8DMJ7OyxO4w9Y&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1318467427&oauth_version=1.0';

But throwing error status code 307.

also i had tried using ng2-twitter package but not working.


回答1:


If you use AngularFire2, then you can get it done by just one line and that is

logintwitter(){
    this.afAuth.auth.signInWithPopup(new firebase.auth.TwitterAuthProvider());
  }



回答2:


I suggest looking at great real world example here https://github.com/gothinkster/angular-realworld-example-app which uses oauth. I also implemented my sample angular app with full working client/server code to login to Facebook, Linkedin and Google https://github.com/anjmao/adify using ExpressJs and PassportJs.



来源:https://stackoverflow.com/questions/45159463/sign-in-with-twitter-using-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!