Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

ngCordova oauth in BlackBerry 10, callback url Error

$
0
0

@dery wrote:

Hi, I'm using ngCordova Oauth and everything look great when i build in android platform.
but when i build to bb10 platform i've got an error after login and redirecting the screen display

Network is Unavailable,Please Try Again Later.

Error in console log display

Failed to load resource: Couldn't connect to server http://localhost/callback?oauth_token=dVwkKwAAAAAAjuptAAABUs_agY8&oauth_verifier=3vjPZpFbXQqvtOhASZjgWusBJTpAg

this is sample my login twitter code

     $scope.twitterLogin = function(){
          var api_key = "DI2m6fz7zTuLWhUGHJGCxxxx";
          var api_secret = "uDZcs9iQi2A8E7tw2k5gEpqHyUoT5KTr9PXCYhTxxxxxxx";



          $ionicLoading.show({template: '<ion-spinner icon="spiral"></ion-spinner>'})
           $cordovaOauth.twitter(api_key, api_secret).then(function(result) {




            function createTwitterSignature(method, url) {
               //var token = angular.fromJson(getStoredToken());
               var oauthObject = {
              oauth_consumer_key: api_key,
              oauth_nonce: $cordovaOauthUtility.createNonce(32),
              oauth_signature_method: "HMAC-SHA1",
              oauth_token: result.oauth_token,
              oauth_timestamp: Math.round((new Date()).getTime() / 1000.0),
              oauth_version: "1.0",
          };

                  var signatureObj = $cordovaOauthUtility.createSignature(method, url,
                      oauthObject,{include_email:true}, api_secret,
                      result.oauth_token_secret);

                  $http.defaults.headers.common.Authorization =
                       signatureObj.authorization_header;
                       var head = signatureObj.authorization_header;
              }

              $scope.getTwitterProfile = function() {

            var deferred = $q.defer();
           // var token = angular.fromJson(getStoredToken());

            createTwitterSignature('GET',
                   'https://api.twitter.com/1.1/account/verify_credentials.json');

            $http.get('https://api.twitter.com/1.1/account/verify_credentials.json'
              ,{params: { include_email: true}}  )
            .success(function(result) {
                      deferred.resolve(result);


            })
           .error(function(error) {
                      alert("There was a problem getting your profile");
                      deferred.reject(false);
            });
            return deferred.promise;
          }

          $scope.getTwitterProfile().then(function(datas){





          })






        $ionicLoading.hide();
      },function(error){

          $ionicLoading.hide();
      })
    }

thanks in advance.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>