August 2019 Status

One reason I like programming is how fast you can make a program and see the results and fix it if there are problems. The nook of the program I have been working on for the past several months has been one button: the facebook Logout button. I can only test it once a day, if that, because I am testing how it works after it doesn't work anymore. For whatever reason the token expires hours after you load the page, so log out works right away but not later. So that's what I'm testing. Making it work later, but I have to wait until later every time to test it. So months have gone by making this button work and I did give up on it, a few days ago I said, ok that's it, it won't work so it's facebook's fault for not making it clear how to make this button work after the token expires. I've tried several variations on it, the one that appeared to work this morning was logout wrapped in a check login state wrapped in a timeout wrapped in another check login state wrapped in another timeout. If you just do logout it works fine .. . . .until later on when the token's expired. If this works, the double wrapper in double timeouts version, i'll test it again this afternoon, then I will be on to bigger and better things in the program very soon! I have big ideas, new features I want to add in, that will be good. I am skeptical though, because I had thought I had tried this before but maybe I hadn't. Hopefully it's correct, I won't know until later today or tomorrow or the next few days for sure. Either way though, I'm moving on, because I've spent too much time on it overall for what it does. Log Out. I guess it doesn't matter that bad if it doesn't work later, it's not worth spending months on. So if it turns out I can't actually get it to work, then it's going to be 'Maybe Log Out' or something, ooh maybe with a hover tip explaining more about why it doesn't work....

I'm really hoping the double-wrapper button I have now works later though, we'll see.....

And although the solution on this page did not work, that is one of the stack overflow pages I found reference to this which helped lead me in the right direction. maybe hopefully. And specifically, the LAST solution with a rating of 1 was the solution I utilized from that page, not the others. And I of course took the refresh line out, window.location = "/"; that's a complete page reload.

If I get it working I'll post it somewhere. I want to make for-sure-for-sure it works first though.


Preliminary test 512: it finally worked! I didn't touch it all day yesterday (presumably far past the breaking point) and it worked for the second time this morning. So maybe I finally stumbled onto it. Ok so if anyone reads this where I'm at right now with it is:
setTimeout FB.getLoginStatus() setTimeout FB.getLoginStatus() setTimeout FB.Logout()
I will post the exact code later but yeah it's a logout wrapped in a timeout wrapped in a getLoginStatus
wrapped in another timeout wrapped in another getLoginStatus wrapped in another timeout. Short timeouts, it's not actually waiting for anything (2 ms). I'm sure some of that is redundant so I'll try and see if you can't take out a layer or two, and post what I come up with in the end. I'm glad there is hope for this because I want all the various functionality to work perfectly, even (especially!) the simple stuff like log out!

I think I was wrong about all the layers you just need one FB.getLoginStatus wrapped around the FB.logout, not certain but that's what I'm going to test next . . . in 8-12 hours . . . if it doesn't work i'll try something in between, I'm certain the one with all the layers works, 90% anyway, it seems like it worked where just logout didn't before anyway, several times, so I'm overall very encouraged i'm hopefully about to figure it out.

I was not wrong. The one-wrap version doesn't work. I just executed my one test for the morning with negative results. One wrap of FB.getLoginStatus around FB.logout indeed does NOT work. So that's taking out three layers from where it did work because the one that did seem to work had a timeout around the FB.getLoginStatus and then another two layers around that, another FB.getLoginStatus wrapped in a timeout. Also the one that seemed to work had some other junk mixed in getting the access token and such i'm pretty sure wasn't doing anything but so my next check, tonight or tomorrow morning will be my expected-to-work simplified version of the one that seemed to work a few days ago which had 5 layers. It would be good to get it straight there's no need to wrap it if there's no need to wrap it - but I am seeing this morning - it has to be wrapped in something. Again, to re-iterate what I am talking about: this is the facebook logout button. FB.logout per the docs. It works fine. At first. Later on, several hours later, an 'access token' expires and the button just doesn't do anything anymore. THAT is what I am trying to fix. That logout button stopping working later. And I think I've got it, I just want to make sure before I'm done with it and move on. It takes a particularly long time to test each nuance because of the nature of the problem - breaking after many hours - and I don't even know exactly how many hours it is, I think its like 4 or something but normally I just wait 12 or something and test since I don't even know what the limit is. I think it says in the auth response too but it's in either microseconds or miliseconds and I haven't been able to logically translate the number into a time I can understand. Long story short I'll probably be done with it soon and then I have more features to add!

I just tested one without the two timeout wrappers and it didn't work. Yesterday I tested the plain one with the checkLoginState wrapped around logout and it didn't work. So I'm back to re-testing the full double timeout and check wrapper. I never know for sure when something does work because I could be early. I just know when it doesn't. So I'm going back to the tests that seemed to work which was logout wrapped in a checkloginstate wrapped in a timeout wrapped in another checkLoginState wrapped in another timeout. Tomorrow.

My simplified timout>check>timeout>check>logout did not work this morning. That's bad news because it could mean the bloated one didn't work either the other day, or it could just mean one of the random grabs of an access token in the middle did it. So this time I think I will wait 3, 4 days, as long as I can wait to test the next test of the one that seemed to work . . . .

Still waiting . . . (I think since Sunday evening, I accidentally reloaded Sunday at the end of the day which resets it...)

I finally after just over a week tested the one that seemed to work before and indeed it seemed to work again, although the temporary secure page permission had expired so I had a somewhat broken looking and seemingly anticlimactic positive test result, meaning that, I think it works. Meanwhile I forked the test site so I can run more parallel experiments now and not have to just wait in between logout button tests that could take a week. The live site hasn't been changed in a while and that is because I have a significantly modded now new version I'm tinkering at and hopefully it will be the next version. In case it flops I still have the live version as a working test site as well.

Sortof. I knocked the 5 second timeout down to 1.5 seconds and the bloated version is still working, has yet to fail. It does some funny things like retrieve the access token and then do nothing with it, i'm not sure if that's actually making it work or what but the good news is it works. I have yet to simplify it and see what's necessary and what's not because every time I take anything out (other than the extra time) it stops working. So i'm happy it looks like i'll be able to pull it all together sooner than later. (The next version with fixed fb login interface buttons and soon after new games, game features, more robots, more ranking systems and lots of other stuff.)