Android Authorization in Facebook does not occur

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Schekhovtsov, Aug 4, 2019.

  1. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    Hello!

    Installed the Facebook extension according to this guide - https://help.yoyogames.com/hc/en-us/articles/360004488072-iOS-Android-and-HTML5-Integrating-Facebook

    Facebook also seems to have configured everything in the developer’s console. In the GMS2 settings inserted the game data from the developer's console (for the extension to work).

    I inserted the authorization code into the button in the game. When clicked, the Facebook authorization window opens (I'm already logged in, so in this form).

    [​IMG]

    When you click OK, the window closes. A pop-up message that should indicate a successful authorization does not appear. There is no connection.

    At the same time, a message appeared that the SDK in the game is out of date.

    [​IMG]

    Update instructions, as I understand it, are not very suitable for GMS - https://developers.facebook.com/docs/app-events/upgrade-guide/

    Maybe authorization does not occur because of this (low version SDK), maybe doesn't, but I have no idea how to update Facebook SDK (This is an extension, after all!)

    Thanks in advance for your help.
     
    Last edited: Aug 4, 2019
  2. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    So. Something seems to work. Facebook analytics shows numbers (though a bit strange. For example, 4 unique users, when a maximum of 2 is possible). It turns out, mb connection status check is not working?
     
    Last edited: Aug 4, 2019
  3. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    208
    @Schekhovtsov
    If you are using show_debug_message . No pop-up message would appear.

    This function is for testing mode only.
    Not compiled apks, and the messages would appear in the adb window.

    Try using testing mode and read what the adb window show when you try to call the Facebook functions, so you can know what the problem is.


    to update the sdk version, you need open the extension in the resource tree and right click on extra platforms "android" and in the inyect to gradle dependencies change the sdk version, but since i don't know how extensions work, i don't know if this could break the extension or not.
     
    Last edited: Aug 4, 2019
  4. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    I tried it. Just changing the numbers doesn't help.

    Please, check adb log. Maybe you can find a problem?
     
  5. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    208
    @Schekhovtsov When I said adb window I meaned the output/compiling window , sorry. Try running the game in test mode and check the output/compiling window
    For any error. Or debug messages
     
    Last edited: Aug 4, 2019
  6. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    @pipebkOT

    Now It seems to me that the problem is in the Facebook developer console. I found such a line in the logs.

    [​IMG]

    It seems that the Android platform has not been added to the console. And so it is! The App Domains glows red, and because of this, the Android platform has not been added. I deleted the App Domains and the Android platform was saved! According to the instructions there should be the URL of the game in the store:
    • App Domains - Provide Google Play and/or Apple App Store URL of your app.
    But he doesn’t like it. I tried the name of the package. He also swears.

    [​IMG] [​IMG]
     
    Last edited: Aug 5, 2019
  7. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    208
    @Schekhovtsov
    First you need to add the Android platform

    [​IMG]
    [​IMG]

    You need to give the hash from they keystore too
     
  8. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    Did this. Still doesn't add. Now I will try to run the application without this field. Can authorize?
     
  9. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    Authorization seems to be successful!

    P.S. App Domain field is empty
     
  10. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    208
    App domain is not obligatory to get the authorization .

    So. You get it solved? Any problems left?
     
    Schekhovtsov likes this.
  11. Schekhovtsov

    Schekhovtsov Member

    Joined:
    Feb 8, 2019
    Posts:
    25
    One more question. The following check was made - after authorization, the button for authorization disappears.

    That is, when you click on the button, authorization is successfully performed.

    [​IMG]

    After restarting the game, the button is again visible, apparently there is no automatic connection to Facebook. But should this happen? Actually, what is required: do not display the authorization button if it has already been performed once.

    [​IMG] [​IMG]

    Code:
    //Facebook
    switch (async_load[? "type"])
    {
    case "facebook_login_result":
    show_debug_message("facebook_login_result async event triggered");
    if async_load[? "status"] == "success"
    {
    if !fb_logged_in
    {
    fb_logged_in = true;
    show_debug_message("User successfully logged in!");
    for (var i = 0; i < ds_list_size(fb_permissions); ++i;)
    {
    var _key = fb_permissions[| i];
    if ds_map_exists(async_load, _key)
    {
    if async_load[? _key] == "granted"
    {
    show_debug_message("Permission " + _key + ": granted");
    }
    else show_debug_message("Permission "+_key + ": "+async_load[? _key]);
    }
    else show_debug_message("Permission " + _key + ": Does Not Exist");
    }
    }
    }
    else show_debug_message("Login failed: " + string(async_load[? "status"]));
    break;
    
    case "fb_graph_request":
    show_debug_message("fb_graph_request async event triggered");
    if async_load[? "status"] == "success"
    {
    show_debug_message("Graph Request Successful!");
    var _text = async_load[? "response_text"];
    var _response = json_decode(_text);
    show_debug_message("Response = " + string(_response));
    fb_username = _response[? "name"];
    fb_userid = _response[? "id"];
    var _pic_map = _response[? "picture"]
    var _data_map = _pic_map[? "data"];
    fb_picture = sprite_add(_data_map[? "url"], 0, false, false, 0, 0);
    }
    else
    {
    if async_load[? "status"] == "error"
    {
    show_debug_message("Graph Request Error!");
    show_debug_message("Exception = " + string(async_load[? "excepton"]));
    }
    else
    {
    show_debug_message("Graph request Cancelled!");
    }
    }
    break;
    }

    Code:
    //Facebook
    fb_init();
    fb_logged_in = false;
    fb_userid = "";
    fb_username = "";
    fb_picture = -1;
    fb_login_default = noone;
    fb_permissions = ds_list_create();
    ds_list_add(fb_permissions, "public_profile", "user_friends");
     
    Last edited: Aug 5, 2019
  12. pipebkOT

    pipebkOT Member

    Joined:
    Dec 13, 2018
    Posts:
    208
    @Schekhovtsov
    Like everything else in your game, you need to save variables in a ini file or something else.
    Then load the variable at the start of the game

    You need to save the fb_logged_in variable, then make a if check in the login_button
     
    Schekhovtsov likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice