Hi guys

I'm sorry to ask here but I have suffering for days now and I'm unable to get this to work. I just want users to log in with Facebook and grab email. Nothing else but they keep on getting the error;

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

On my recent log messages I get;

LOCATION http://www.oflocal.co.za/hybridauth/window/Facebook?destination=node/21&...
REFERRER
MESSAGE Exception: Authentication failed! Facebook returned an invalid user id. in Hybrid_Auth::initialize() (line 169 of /usr/www/users/oflocdvzeb/sites/all/libraries/hybridauth/hybridauth/Hybrid/Auth.php).

My app setting are attached.

Any ideas why this is not working? I have followed every guide and still doesn;t work.

Thanks

Rick

Comments

besnikt created an issue.

xaa’s picture

Hi Rick, have you found a solution?

rickharington’s picture

Hi xaa

I suffered on this for ages. Eventually went with https://www.drupal.org/project/social_login

It's paid but only after 2000 registered per year.

Sorry can't be more help.

zeroduh’s picture

For me it was the plugin HybridAuth, this method (getAcessTokenFromCode() in Hybrid/Providers/Facebook.php) was setting the wrong redirect_uri, because we have a mobile cache that set some parameters in the url. When the function is called its fetch the current url with all parameters in the url differing from the original redirect_uri passed on the method getLoginUrl() in base_facebook.php. A ugly fix was to call again this getAcessTokenFromCode() passing the correct redirect url:

class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
	...
	/**
	 * {@inheritdoc}
	 */
	function initialize() {
		...

		// if ($this->token("access_token")) {
		// 	$this->api->setAccessToken($this->token("access_token"));
		// 	$this->api->setExtendedAccessToken();
		// 	$access_token = $this->api->getAccessToken();

		// 	if ($access_token) {
		// 		$this->token("access_token", $access_token);
		// 		$this->api->setAccessToken($access_token);
		// 	}

		// 	$this->api->setAccessToken($this->token("access_token"));
		// }
		// 

		if ($this->token("access_token") || isset($_REQUEST["code"])) {
			if($this->token("access_token")) {
				$this->api->setAccessToken($this->token("access_token"));
			} else if(
				isset($_REQUEST["code"]) &&
				$access_token_from_code = $this->api->getAccessTokenFromCode($_REQUEST["code"], $this->config["hauth_return_to"]."?hauth.done=Facebook")
			 ) {
				$this->api->setAccessToken($access_token_from_code);
			}

			$this->api->setExtendedAccessToken();
			$access_token = $this->api->getAccessToken();

			if ($access_token) {
				$this->token("access_token", $access_token);
				$this->api->setAccessToken($access_token);
			}

			$this->api->setAccessToken($this->token("access_token"));
		}

		$this->api->getUser();
	}
} 

Note that the method getAcessTokenFromCode() was needed to be public;

Sorry about the mispellings (:

anybody’s picture

If you should run into these problems please see and comment #2684015: Authentication failed! Facebook returned an invalid user id