Ng-cordova-oauth and firefox os

Hello all, I need some help with firefox os and ng-cordova-oauth.

I want to login using a github account but I have an strange behaviour in my app, after I’ve logged in on github, the app redirects to my index but it seems that the app embeds the index instead of redirecting to it. See the image below.
image

This is the code of my app.js:

angular.module('githubIssuesApp', ['ionic', 'ngCordova'])

.config(function($stateProvider, $urlRouterProvider){
  $stateProvider
    .state('home', {
      url: '/',
      templateUrl: 'templates/home.html',
      controller: 'homeCtrl',
      data: {
        authenticate: true
      }
    })
    .state('signin', {
      url: '/signin',
      templateUrl: 'templates/signin.html',
      controller: 'signInCtrl',
      data: {
        authenticate: false
      }
    });

  $urlRouterProvider.otherwise('/signin');
})

.run(function($ionicPlatform, $rootScope, $state, userService) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });

  // UI Router Authentication Check
  $rootScope.$on('$stateChangeStart',
    function(event, toState, toParams, fromState, fromParams){
      console.log('state change start');
      if(toState.data.authenticate && !userService.isLoggedIn()){
        event.preventDefault();
        $state.transitionTo('signin');
      }      
    }
  );
})

/**
 * sign in controller
 */
.controller('signInCtrl', ['$scope', 'userService', function($scope, userService){
  $scope.signIn = userService.login;
}])

**
 * User service
 */
.factory('userService', ['$rootScope', '$state', '$cordovaOauth',
  function($rootScope, $state, $cordovaOauth) {
    var provider = 'github';

    var service = {
      isLoggedIn: function() {
        return $rootScope.userStatus;
      },
      login: function() {
        $cordovaOauth.github('27879518b3200cb586da', '3451fe872df74723655133d8e2c20c68417a4079', ['email'])
          .then(function(data){
            console.log(data);
            $rootScope.user = data;
            $rootScope.$apply($rootScope.user);
            $rootScope.userStatus = true;

            $state.go('home');
          }, function(err){
            alert(err);
          });
      },
      logout: function() {

        console.log("logut");
      }
    };

    return service;
  }
]);

and this is the manifest.webapp:

{
    "launch_path": "/index.html",
    "installs_allowed_from": [
        "*"
    ],
    "version": "0.0.1",
    "name": "github-issues",
    "description": "...",
    "developer": {
        "name": "Mozilla El Salvador",
        "url": "http://carloscarcamo.me"
    },
    "icons": {
        "60": "/icon/icon-60.png",
        "128": "/icon/icon-128.png"
    },
    "redirects":[{
      "from":"http://localhost/callback",
      "to":"/index.html"
    }]
}

Note: the redirects at the end of the app manifest is necessary because firefox simulator gives 404 error with http://localhost, so I redirect from http://localhost/callback to my index.

Any thoughts about what i’m doing wrong?

It might be due to a fact that Ionic does not support FirefoxOS. I might be wrong on this assumption.

mmm, that’s would be sad, I really love this framework and I would like to use it for developing firefox os app.

I might be wrong also.

I guess apart from layout issues, ideally there should not be any other problem.

Hmm, haven’t played around FFOS yet, there is this open issue though

1 Like

Is a problem of the cordova plugin, InAppBrowser, it doesn’t support firefoxos, I opened an issue on the ng-cordova-oauth repo, at github, where the author of the library replied:

The event listener, an essential component, is not compatible with Firefox OS.
Because of this, my implementation of Oauth will never work for Firefox OS…

That was very sad for me, I have to find another way to achieve an oauth authentication on firefoxos.