I\'m trying to configure HybridAuth and I\'m in the very early stages. Right now all I want to do is connect and make sure HA will redirect to facebook and prompt for app i
I've managed to figure out why this error appears even in current version of hybridauth and facebook sdk.
The reason is in the way how hybridauth and google or facebook sdk builds redirect_uri parameter. As We know from https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/ first we have to redirect user to facebook ( with redirect_uri param ) and it returns code in response by default. Than we sent http request using curl again ( with redirect_uri param ) and these urls doesn't match, because of the reason mentioned before.
Other words if you set in hybridauth config
"base_url" => "http://
( without slash ) -> it will work fine for google, but give you this stupid message error for facebook login.yourhost
/hybridauth/hybridauth"
"base_url" => "http://
, ( with slash ) will work ok with facebook but will result error with google with clear error "Redirect Uri missmatch".yourhost
/hybridauth/hybridauth/"
So not the best by quick fix is "base_url" => "http://
" ( without slash ) in config.yourhost
/hybridauth/hybridauth
And then choose how to build uri depends on provider.
in Provider_Adapter.php comment line 131
// $this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, '?' ) ? '&' : '?' ) . "hauth.done={$this->id}";
and add these two instead.
$dlm = $this->id == "Facebook" ? "/?" : "?";
$this->params["login_done"] = $HYBRID_AUTH_URL_BASE . ( strpos( $HYBRID_AUTH_URL_BASE, $dlm ) ? '&' : $dlm ) . "hauth.done={$this->id}";
Such way we have solution to support both Facebook and Google.