AlmogBaku / ngFacebook

DEPRECATED Angular facebook service
MIT License
261 stars 70 forks source link

login should allow setting of all options #28

Closed rsiemens77 closed 9 years ago

rsiemens77 commented 10 years ago

It seems the assumption was made that "permissions" should be the only available option. I suggest allowing an options object to be passed through as the facebook sdk uses. There are some fairly common use cases where you need to set more than permissions: eg. auth_type='rerequest'.

If anyone requires this immediately, you can try this (note, I commented out default permissions, as I don't require it and didn't want to bother fixing it).

  $facebook.login = function (args) {
    //if(permissions==undefined) var permissions=$facebook.config("permissions");
    var deferred=$q.defer();
    return $facebook.promise.then(function(FB) {
      FB.login(function(response) {
        if(response.error)  deferred.reject(response.error);
        else                deferred.resolve(response);
        if(!$rootScope.$$phase) $rootScope.$apply();
      }, args);
      return deferred.promise;
    });
  };
AlmogBaku commented 9 years ago

re request option was added on https://github.com/GoDisco/ngFacebook/pull/24