ngCordovaOauth and twitter problem


#1

Hi I’m developing an app to authenticate users using twitter. The facebook authentication works fine but when the twitter section is called I get the following error.

```
TypeError: Object #<e> has no method 'success'
at Object.d [as twitter] (file:///android_asset/www/lib/ng-cordova-oauth/dist/ng-cordova-oauth.min.js:4:11050)
at Object.login (file:///android_asset/www/js/services.js:140:27)
at m.scopeLogin [as login] (file:///android_asset/www/js/controllers.js:183:14)
at fn (eval at <anonymous> (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js:237:285), <anonymous>:4:302)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:65429:9
at m.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js:147:313)
at m.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js:148:17)
at HTMLButtonElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:65428:13)
at cg (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js:38:299)
at HTMLButtonElement.d (https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js:38:246) angular.js:14328
```

My Code is,

```
var res;
       if(provider==="facebook"){
        $cordovaOauth.facebook("xxxxxxxx", ["email"]).then(function(result) {               
            console.log(result.access_token);
            console.log("Response Object -> " + JSON.stringify(result));
            credential = firebase.auth.FacebookAuthProvider.credential(result.access_token);
            res = auth.$signInWithCredential(credential);
        }, function(error) {
            console.log("Error -> " + error);
            //res = auth.$signInWithCredential("ewrdfwer");
        });
       }
      
       else if(provider==="twitter"){
        $cordovaOauth.twitter("xxxxxxxx","xxxxxxxx").then(function(result) {               
            console.log(JSON.stringify(result));
             credential = firebase.auth.TwitterAuthProvider.credential(result.access_token);
             res = auth.$signInWithCredential(credential);
        },function(error){
            console.log("Error -> " + error);
        });
      }

```         

I have added the jsSha(1.6) sha1.js file and have set the callback url to http://localhost/callback
*I’m using firebase 3 and angularfire2 in order to connect to firebase as well.

Please help…


#2

To have a chance you should provide links for the libraries you are using. Is see Twitter, Firebase, Angularfire, Facebook…


#3

I’m using Nic Raboys’ ng-cordova-oauth library

Firebase 3.9.0
https://www.gstatic.com/firebasejs/3.9.0/firebase.js

Angularfire 2.3.0
https://cdn.firebase.com/libs/angularfire/2.3.0/angularfire.min.js