Log out from Facebook using Oralce Apex in 2021

I am trying to do a multi login like the ones Dimitri has done in this post:

Everything works perfectly but I can’t log out of facebook, when I try to do it, it gives me a null value and tells me that the state of the session is unknown.

On other occasions it tells me that I am trying to do something without having the token.

In the facebook documentation it says that the call to the sdk and the declaration of the functions must be done in a script before the body tag in my HTML, being in APEX I am not sure where these things should go, I have tried putting things in the global JavaScript of the page or in the body of the HTML or in the header of the HTML since that is where APEX allows me but I continue without getting it to work, some help please

Source: Facebook SDK Questions