Search code examples
facebook-loginfacebook-unity-sdkfacebook-permissions

Facebook SDK 6.0 for Unity: I don't understand how permissions work


I seriously do not understand how the permissions work. Let me explain:

  1. I have a Facebook app set in my developer account
  2. I have defined a test app
  3. In my Unity app using the Facebook SDK, Im calling this login function:

    string permissions = "public_profile,user_bithday,user_location";
    FB.Login (permissions, LoginCallback);
    
  4. After the callback, I'm asking for the granted permissions and I'm getting:

    request response: {"data":[{"permission":"public_profile","status":"granted"},{"permission":"email","status":"granted"},{"permission":"publish_actions","status":"granted"},{"permission":"user_birthday","status":"granted"},{"permission":"user_likes","status":"granted"},{"permission":"user_photos","status":"granted"},{"permission":"user_friends","status":"granted"}]}
    

I have to say that I'm still experimenting with the SDK making with the same Facebook app, different logins from different Unity projects (from the Editor of course). The permissions I am getting are the one I asked with a project I was developing 3 weeks ago. Because everything was working, I focused on something different. Today I made a new project by asking for the permissions defined in the login function in the point 3.

My question is: why am I getting permissions I didn't ask for? Will I have the same problem when I'll deploy the app on different devices? [EDIT] More important than those, why I'm not getting the permissions "user_location" I'm asking for? It's not even saying that the requested permission has been denied. [/EDIT]

The idea is to use the same Facebook app but with 2 different Unity projects: one project is a game that will be deployed on iOS and Android and another one is a standalone app for Mac and Windows that will allow the authorized person to modify the game (let's say a game editor). As you can guess, the projects will need different permissions. Is this something duable or because I'm using 2 different projects with the same Facebook app I'll have problems?

Cheers for the help guys :-)


Solution

  • Once a user has granted a certain Facebook app permissions, they stay there unless the developer or the user explicitly take them away; The FB.Login() call is there to ensure that you have, at a minimum, the permissions you've requested.

    Incidentally, Facebook recommends asking for permissions only at the exact point you need to use them; Asking for more permissions is done with FB.Login("just_the_new_permission_you_need") and it won't take away what the user gave thus far.

    tl;dr yes, using two projects with the same appid means permissions from one will be granted to another and vice-versa.