facebookfacebook-graph-apiunity-game-engineoauthfacebook-unity-sdk

Facebook oauth 2.5 expired today = 400 Bad request in prod


Today (April 12th 2018) FB deprecated oauth 2.5 and all of my Unity android game's users got error: "400 Bad Request". I've added the all possible redirect URI's in developer settings and upgraded the oauth to 2.6 (and also tried 2.7) but it is still not working. Production users receive same "400 Bad request" error and my game login is not working. Please give me some ideas on how to fix this without creating new app update that will take months to update to all users.

This is the prod code that fails:

FB.API("/me?fields=id,name,gender,first_name,last_name,email", HttpMethod.GET, new FacebookDelegate<IGraphResult>((IGraphResult e) => onFBUserInfo(e)));

Thank you!!!

UPDATE: The exception is: OAuthException 2500 An active access token must be used to query information about the current


Solution

  • Thanks to @CBroe I managed to solve the problem by deleting user permission using his scoped_id and getting App Token. Here is the Graph Explorer screenshot. Now I'll automate the process and revoke all users: enter image description here

    UPDATE: I was able to make graph api DELETE script, which resets my users permissions and they are able to login normally. However, the root cause of the issue seems to be on facebook's side as this is what FB tech support replied:

    The issue seems to be on our side. We have just applied a fix to address FB Login issues with Unity, related to access token

    Here is my JS reset permission script:

    function deleteALL(index, endIndex) {
        var access_token = "<INSERT YOUR APP TOKEN HERE>";
        var URL = "https://graph.facebook.com/v2.11/"+arr[index]+"/permissions/?method=delete&access_token="+access_token;
        $.ajax({
          url: URL,
          context: document.body
        }).done(function(data) {
            console.log("SUCCESS:"+data.success+" index: "+index);
          if (endIndex > index+1)
              deleteALL(index+1, endIndex);
        }).fail(function() {
            console.log("FAILED: index: "+index);
          if (arr.length > index+1)
              deleteALL(index+1, endIndex);
        });
    }