Search code examples
angularjsfacebookcordovaionic-frameworkcordova-plugins

Revoke access facebook ngCordova


i currently using the ionic-framework and ngCordova for a mobile app. I'm using ngCordova's Oauth $cordovaOauth http://ngcordova.com/docs/#Oauth for facebook log in.

this is the following code

$scope.facebookLogin = function() {
    $cordovaOauth.facebook("CLIENT_ID_HERE", ["email"]).then(function(result) {
        // results
    }, function(error) {
        // error
    });
}

my problem is that if the user decides not to share his email, i need to ask him again by revoking the access. How can i do this?


Solution

  • According to the Facebook documentation you need to add auth_type=rerequest to the Oauth call.

    See the documentation on this here:

    https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.2

    Currently ngCordova only supports Facebook sign in on its most basic level so the library source would need to be edited to support this change:

    https://github.com/nraboy/ng-cordova-oauth/blob/master/ng-cordova-oauth.js#L198

    I suggest you add a ticket if you don't want this feature yourself:

    https://github.com/nraboy/ng-cordova-oauth/issues

    Regards,