client sdk login with facebook permissions

Is it possible to enforce additional permissions because the function does not seems to accept them.
The method is loginWithFacebookSdk. However the method loginWithFacebook does support permissions, but does not require the Facebook SDK.

Hi Jonas,

If you work with iOS/Swift you could use this app delegate:

    // since iOS 9.0
    func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
        
        print("AppDelegate (iOS9 >) -> application:openURL: \(url.scheme)")
        
        let sourceApplication = options[UIApplicationOpenURLOptionsSourceApplicationKey]?.description
        let result = FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: sourceApplication, annotation: nil)
        if result {
            
            let token = FBSDKAccessToken.currentAccessToken()
            let fieldsMapping = [
                "id" : "facebookId",
                "name" : "name",
                "birthday": "birthday",
                "first_name": "first_name",
                "last_name" : "last_name",
                "gender": "gender",
                "email": "email"
            ]
            
            backendless.userService.loginWithFacebookSDK(
                token,
                fieldsMapping: fieldsMapping,
                response: { (user: BackendlessUser!) -> Void in
                    print("user: \(user.email) [\(user.name)]")
                    self.validUserTokenSync()
                },
                error: { (fault: Fault!) -> Void in
                    print("Server reported an error: \(fault)")
            })
        }
        
        return result
    }

Regards,
Slava

Thanks for the help, but I need a solution for the JavaScript library.

Any update?

Hi Jonas,

What specific permissions are you looking for?

Regards,
Mark

Additional permissions such as described here: https://developers.facebook.com/docs/facebook-login/permissions.

But I just dived into the source code and I might be able to do the FB.login by myself and afterwards create a user on Backendless. However, a feature to list permissions such as available with the method loginWithFacebook would be nice.

Hi Jonas,

Seems this is a drawback in our SDK. Since all our SDKs are open-source, we would be very grateful if you could add this functionality to the SDK as a pull request. You may refer to the way its done with a simple loginWithFacebook.

Or at least you may create an issue on the GitHub tracker, so that it will be better tracked on our roadmap.

Actually, the issue has just been created: https://github.com/Backendless/JS-SDK/issues/39

Hi Jonas,

I glad to notify you that this issue has been resolved.
Please, update Backendless SDK up to v3.1.16.
Some code snippets:

 var options = {scope: 'email, user_likes'};
 var fieldsMapping = {};
 var stayLoggedIn = true;
    
 $('#fb_login').on('click',function(){
        Backendless.UserService.loginWithFacebookSdk(fieldsMapping, stayLoggedIn, options, new Backendless.Async( callback, gotError ) );
 });

Please, notice that if you want to use loginWithFacebookSdk you should init facebook SDK as it was said in the Login With Facebook SDK section of docs.
Regards, Ilya