Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Facebook api scores

Discussion in 'Scripting' started by Hitchmeister, Sep 26, 2014.

  1. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Hello Unity Community.

    I've been having some problems with the latest facebook api.
    I'm trying to make a facebook leaderboard system for my new game, this didnt seem to work because of a permission I needed. I have submitted to facebook for a publish_actions permission and this has been granted.

    Now I still cant get my friends scores for some reason.

    FB.Login("email,publish_actions,user_friends,user_games_activity,friends_games_activity", LoginCallback);
    This is what I use to login. I know its a lot, but i'm just trying to figure out what I need to make this work.

    Then to get the scores I ask the api this.
    FB.API("/532572280219569/scores", Facebook.HttpMethod.GET, ScoresCallback);
    I also tryd this...
    //FB.API("/app/scores?fields=score,user.limit(100)", Facebook.HttpMethod.GET, ScoresCallback);
    //FB.API("/ 532572280219569/scores?fields=score,user.limit(100)", Facebook.HttpMethod.GET, ScoresCallback);
    //FB.API("/532572280219569/scores", Facebook.HttpMethod.GET, ScoresCallback);
    //FB.API("/app/scores?fields=scores", Facebook.HttpMethod.GET, ScoresCallback);


    But the user only gets back he's own score. Only the developer gets all scores.

    Is there something I'm missing of permissions? our wrong with my api request?

    ps: I'm using the facebook sdk plugin for unity.

    Thank you very much for any respons! I'm been stressing about this for weeks :(

    *Update
    I submitted today for an extra permission "user_games_activity" (Provides access to a person's game activity (scores, achievements) by any game the person has played)
    thats the info facebook is giving me about "user_games_activity", so I'm hoping maybe its because of this permission that I get stuck for the leaderboard system.
     
    Last edited: Sep 27, 2014
  2. EmilEkdahl

    EmilEkdahl

    Joined:
    Apr 25, 2014
    Posts:
    3
    The only thing you need is user_friends and publish_actions.

    User_games_activity is for all games, not only your app.

    Request with "app/scores" since app is bound to your appid from the login.

    If it doesnt work, make sure you remove all permissions from facebook first by logging in and deleting your app from the list of apps the user has access too.

    I had the same problem, and i think that user_friends is the problem, if you auth once without it, you wont get it the second time even if facebook returns that it should work.
     
    Hitchmeister likes this.
  3. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Thank you very much!
    This solved it. Its such a noob mistake :(

    I canceled my "User_games_activity" permission request.

    Thanks again for the fast respons and solution! I would not have thought of that.
     
  4. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    @EmilEkdahl

    HEY NEED HELP

    I was looking for this same issue,
    I am getting my FB NAME and SCORE in the leaderboard but I can't see my FB Friends Name or score.
    And I am kinda confused about your answer.
    user_friends and publish_actions were approved already.
    Could you explain this bit more detail.
    Sorry for asking stupid question.


    Thanks a lot in advance
     
    Last edited: Jan 10, 2015
  5. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    Anybody guys, I am kinda bugging into deadline!!!
     
  6. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Hello,

    Tomorrow I'm home and then I could help you more (or more info, or sample project).
     
  7. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    Thanks I will wait.

    I just have same issue but i dont understand exactly he is saying
     
  8. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Is this for ios, android, wp8, web,...
     
  9. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    For Android
     
  10. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Did you already requested this on facebook? You have to upload your apk to facebook an ask permission (user_friends and publish_actions ) to you this and why you need this.
     
  11. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    I need it for leaderboard for the Android

    user_friends and publish_actions already got approved.

    Same problem which you had.

    I can see my Facebook Name and Score in my leaderboard but I can't see my facebook Friend's Name or Score even though they are my friends in FB.

    I also tried with different Facebook accounts.
     
    Last edited: Jan 11, 2015
  12. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Alright then, you have to go to your facebook, and then to settings, there you can select "Apps" and you can see your own app in there. Remove your app in there. And then open your app on your phone and login again on startup. This should reset your permissions.

    Good luck!!!
     
  13. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    Are you sure mate? Coz I tried logging in with different FB accounts in my mobile, that is not working too.
     
  14. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Are you sure facebook approved your submission? Did you get an mail from facebook that to your request was approved?
     
  15. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    Yes mate, Sure.

    I also created new facebook accounts and made those two friends and tested in mobile. Still I am looking at the logged in person's Facebook Name and Score, not the friend's name and score.
     

    Attached Files:

  16. Hitchmeister

    Hitchmeister

    Joined:
    Dec 2, 2013
    Posts:
    8
    Can you show me your login code? And code on how you retrieve your friends scores?

    I'm still not at home, sorry I can't upload something
     
  17. harshat30

    harshat30

    Joined:
    Jan 9, 2015
    Posts:
    11
    I am at friends place so I will send as soon as I reach my laptop.