Javascript Error / Facebook Plugin

0 favourites
  • 7 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Si I'm not sure it's a bug more than my poor understanding of code, but I have a problem with the facebook object.

    When I am logged in, all is well I prompt to share...etc but every time I try to logout I have a Javascript Error.

    Javascript error!

    TypeError: response.authResponse is null

    http://localhost:50000/Facebook_plugin.js, line 115 (col 4)

    I'm not really a dev so I don't understand what is the problem. I made sure the player had to be logged in to be able to log out. Is it because I am in localhost ?

    Also unrelated to that error but is it possible to choose where the facebook dialog for login and share is going to appear ? It is always appering one the edge of the screen, which is not really good.

    Thank you for your time and your help !

  • So after a little bit of research I found that it could be because of the API calling for facebook just after the log out. The only topics I found where related to the API and not the facebook object from construct 2, On those people say you have to destroy the facebook session on your site and that there is no need to log out the user from facebook.

    So I was looking for how to destroy the facebook session but I found nothing, I think the login info could be stored somewhere and that he could be deleted. Anyone know how ?

    I will continue my search but I really appreciated your help if someone knows how to do this. Log out from my web browser game without really login out of facebook.

    Thank you !

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So after long hours of search and tries I still do not know how to destroy the facebook session. I tried with the local storage to clear it at the end of the game but it doesn't seem to work.

    If anyone can offer help I would be grateful, in 4 days it will be too late and I am not sure to find it in time. I will still continue my search, hoping someone had the same problem at some point.

    Tahnk you !

  • Modify Plugin to check if response["authResponse"] exists...

  • Modify Plugin to check if response["authResponse"] exists...

    Ashley has said many times that users should not modify official plugins.

    Kiyki

    If you think you have found a bug or a need for the official plugin to be updated, then post a bug report following all the guidelines and Ashley will then check it out.

  • I am new to community, sorry for misleading. As Ashley said and zenox98 warned again, i strongly recommend to not make this change unless you are doing this just for fun as i do... Also maybe Ashley can check if this fix is worth to do it or not..

    Before calling onFBLogin() you look for fbUserID.. On cases which user close browser and re-open again somehow session is still alive but you are not authorized by facebook api.. On this cases you will get response.authResponse is null error.. To avoid this error you can try to modify runtime.js as below (starting line 114)..

    I am still using the free edition, maybe personal editions dont have this issue..

           FB.Event.subscribe('auth.login', function(response) {
                 if(response["authResponse"]){ // Check if response.authResponse exists
    				fbUserID = response["authResponse"]["userID"];
    				log("User ID = " + fbUserID);
    				onFBLogin();
                  } // close if
    	});
    [/code:q0faifuw]
  • I've changed the next build to check authResponse exists before using it, hopefully that will resolve this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)