Javascript Error / Facebook Plugin

Get help using Construct 2

Post » Tue Jun 30, 2015 4:33 am

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 !
B
5
S
1
Posts: 19
Reputation: 415

Post » Tue Jun 30, 2015 6:46 pm

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 !
B
5
S
1
Posts: 19
Reputation: 415

Post » Wed Jul 01, 2015 11:43 pm

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 !
B
5
S
1
Posts: 19
Reputation: 415

Post » Fri Jul 31, 2015 9:20 am

Modify Plugin to check if response["authResponse"] exists...
B
4
S
1
Posts: 4
Reputation: 358

Post » Fri Jul 31, 2015 9:58 am

acbaltaci wrote: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.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,548
Reputation: 60,440

Post » Fri Jul 31, 2015 11:11 am

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..

Code: Select all
       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
   });
B
4
S
1
Posts: 4
Reputation: 358

Post » Mon Aug 03, 2015 11:11 am

I've changed the next build to check authResponse exists before using it, hopefully that will resolve this.
Scirra Founder
B
402
S
238
G
89
Posts: 24,629
Reputation: 196,025


Return to How do I....?

Who is online

Users browsing this forum: humanescape and 9 guests