Getting null error message when using ng-cordova-oauth for Twitter

I’m trying to get the user’s twitter followers emulating on Android.

Buy I’m getting null error:

$ ionic emulate android --livereload  --consolelogs
...
0     638883   log      Error -> null

Things I’ve tried:

  1. I added this to the config.xml:
<access origin="*"/>
  1. Added this to the index.html:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
  1. I’ve set the callback url on Twitter to http://localhost/callback via http://tinyurl.com/krmpchb

This is my controller:

angular.module('starter')
.controller('AppCtrl', function($scope, $ionicPlatform, $timeout, $cordovaOauth) {

  var api_key = "xxx";
  var api_secret = "xxx";

  $ionicPlatform.ready(function() {
    $cordovaOauth.twitter(api_key, api_secret).then(function(result) {
        console.log("Response Object -> " + JSON.stringify(result));
    }, function(error) {
        console.log("Error -> " + error);
    });
  };
...

Is there another way to debug the issue? is the twitter API permissions? the callback? Content-Security-Policy?

1 Like

Solved it. Not using --livereload fixed it

1 Like

That did not solve the problem for me. I still get null.