PHP HybridAuth social signin not working at all. Redirecting to ?hauth.start=Facebook&hauth.time

后端 未结 5 2232
自闭症患者
自闭症患者 2021-02-02 14:36

I was trying to make HybridAuth Social Login work on this simple php site. Downloaded HybridAuth and installed it. Then found that even the examples does not work for social log

5条回答
  •  遥遥无期
    2021-02-02 14:53

    Alright, I've solved it myself.

    As stated before, the documentation was really not good. Here's the solution for anyone who wants to integrate this code in future

    Firstly, you have to make your baseurl like this in config.php

    "base_url" => "http://yoursite.com/subdomain/index.php", OR
    
    "base_url" => "http://yoursite.com/index.php",
    

    Note that I'm not using www. Don't know why, but it does not work with www.

    Now the tricky part, you have to include this in your index.php file

    require_once( "PATH_TO_HYBRID/Auth.php" );
    require_once( "PATH_TO_HYBRID/Endpoint.php" ); 
    
    if (isset($_REQUEST['hauth_start']))
            {
                Hybrid_Endpoint::process();
    
            }
    

    The Endpoint Process is what makes you redirect to a blank page if not provided. And you must add it to the index.php as far as I've tested.

    Now the code should work fine :) I'll be happy if it helps someone.

提交回复
热议问题