Making use of facebook session token to avoid calling facebook.login all the time

Hi,

Does anybody know if the facebook plugin has a way to check if the session token is still valid?  Im trying to avoid having to login to facebook every time my app loads up / i want to make a request - for me I get the blue screen flash up all the time which is a bit annoying…

I was thinking that I could check if the session is valid and if it is then I can just skip over the facebook login part and just call whatever request I want e.g. get friends list.  

If however, If the session wasnt valid then I would call log in, followed by my request e.g. get friends list

I guess I could compare the expiry times and do it that way too…

Why I am not sure is because all the examples I see in corona always call login before doing any kind of api request.

How are other people handling this?  maybe there is a technical reason why we have to always log in first?

Thanks

Just for the benefit of others…

Thanks to RedPistonEB, I have managed to stop facebook from flashing up every time.

In my code I had the following:

 facebook.login( appId, callFacebook, {"email, user\_friends"} ) 

And changing it to be this fixed the issue:

facebook.login( appId, callFacebook2, {"email", "user\_friends"} ) 

What is strange is that both version correctly prompt for all the permissions i.e. public, email and friends.

Now facebook doesnt flash up, I’ll just stick to logging in each time as it will keep the session current 

Just for the benefit of others…

Thanks to RedPistonEB, I have managed to stop facebook from flashing up every time.

In my code I had the following:

 facebook.login( appId, callFacebook, {"email, user\_friends"} ) 

And changing it to be this fixed the issue:

facebook.login( appId, callFacebook2, {"email", "user\_friends"} ) 

What is strange is that both version correctly prompt for all the permissions i.e. public, email and friends.

Now facebook doesnt flash up, I’ll just stick to logging in each time as it will keep the session current 

Hi,

could you explain why changing the name of the listeners help to avoid Facebook flashing everytime? Thank you.

I’m trying to avoid the FB app/browser prompt once the user had logged before and does “FB stuff” later sessions (I’m trying an auto-login, but it allways shows the app/browser)

Hi,

Its easy to miss but the difference is that the working version passes a table with two entries where as the first passed one entry with a comma separated string:

Do not do it this way:   {“email, user_friends”}

Do it this way:   {“email”,  “user_friends”}

​The above are not equivalent hence the issue

Do you still see the flashing using the second method?

you also need to ensure facebook is configured correctly in the portal… From memory I think you need to have SSO enabled and configured

Hi,

could you explain why changing the name of the listeners help to avoid Facebook flashing everytime? Thank you.

I’m trying to avoid the FB app/browser prompt once the user had logged before and does “FB stuff” later sessions (I’m trying an auto-login, but it allways shows the app/browser)

Hi,

Its easy to miss but the difference is that the working version passes a table with two entries where as the first passed one entry with a comma separated string:

Do not do it this way:   {“email, user_friends”}

Do it this way:   {“email”,  “user_friends”}

​The above are not equivalent hence the issue

Do you still see the flashing using the second method?

you also need to ensure facebook is configured correctly in the portal… From memory I think you need to have SSO enabled and configured