Hybrid Auth - “This page cannot be accessed directly” error
-
14-03-2021 - |
Question
Talking about Hybid Auth, I'm using Facebook to login the users, but I don't know what did I modify in the code that is causing the system to show the "Sorry, This page cannot be accessed directly" message.
I see it's related with the $_SESSION["HA::CONFIG"] variable when the system is checking if Hybrid_Auth session already exist in the file hybridauth/hybridauth/index.php
Could you let me know how can I fix this?
La solution
I'm using HybridAuth 2.0.11 Installer While you are installing Hybrid Auth via the /hybridauth/install.php ensure that the HybridAuth Endpoint URL contains the url in the format http://domain.com & not http://www.domain.com or some other subdomain Also verify that the you have the same format of the url mentioned in your facebook twitter linkedin developer accounts.
Autres conseils
I encountered this issue when trying to sign in using Firefox
and although hybridauth
was working great on all browsers, it was failing on Firefox browsers. so if you are looking for an answer to
hybridauth firefox You cannot access this page directlyhere is the solution.
the problem is that Firefox
has a caching mechanism for page redirects, you can find out more about this topic on this thread firefox-5-caching-301-redirects
as a result, if you are trying to authenticate a user on a login page
and the cache headers for that page were in the range of 30x (301-302-303-304...) firefox is more likely to cache that page on the client side.
So when a user tries to sign in, thelogin page
will not be processed on your server, instead firefox
will serve a cached version of the login page
which redirects to the hybridauth
authentication page, failing in turn to initialize the Session Object
required for authentication.
Solution: turn off the caching headers
for the login page
and make sure that it returns a 200
code
My Facebook App was in Sandbox mode, disable Sandbox fixed it for me!!
Use $_SERVER['SERVER_NAME'] in the endpoint URL when configuring HybridAuth