Skip to content Skip to sidebar Skip to footer

Javascript Oauth Sign In With Twitter

I have to integrate Sign-in-with Twitter in my app as below. https://dev.twitter.com/docs/auth/sign-twitter It is browser based app developed in JavaScript I have been refering go

Solution 1:

Problem with this is that anyone who views your page can also now view your consumer key and secret which must be kept private.

Now, someone could write an app that uses your app credentials and do naughty and bad things to the point that twitter and users ban you, and there isnt anything you can do.

Twitter do state that every possible effort must be made to keep these values private to avoid this happening

Unfortunately, there is currently no way to use oAuth in Browser based JavaScript securely.

Solution 2:

Check out the Twitter @Anywhere JSDK authComplete and signOut events and callbacks at https://dev.twitter.com/docs/anywhere/welcome#login-signup

twttr.anywhere(function (T) {

    T.bind("authComplete", function (e, user) {
      // triggered when auth completed successfully
    });

    T.bind("signOut", function (e) {
      // triggered when user logs out
    });

});

Solution 3:

Use below code in consumer.js and select example provider in index.html drop down list

consumer.example=
{ consumerKey   :"your_app_key"
, consumerSecret:"your_app_secret"
, serviceProvider:
  { signatureMethod     :"HMAC-SHA1"
  , requestTokenURL     :"https://twitter.com/oauth/request_token"
  , userAuthorizationURL:"https://twitter.com/oauth/authorize"
  , accessTokenURL      :"https://twitter.com/oauth/access_token"
  , echoURL             :"http://localhost/oauth-provider/echo" 
  }
};

Solution 4:

Since I was searching for the same thing, trying not to use a custom PHP solution, I came across this very simple integration at http://www.fullondesign.co.uk/coding/2516-how-use-twitter-oauth-1-1-javascriptjquery.htm which uses a PHP proxy that accepts whatever twitter api call you'd like to retrieve from your javascript ..

I'm definitely taking a look at it

Post a Comment for "Javascript Oauth Sign In With Twitter"