Anvard problems when redirecting

Issue #26 new
Salvo Rosario created an issue

Hi to everyone.

I've a problem when I try to use the Anvard/HybridAuth functions. This is the scenario. I have a page (it may be a single .php file, another app, a shop, ecc) and I want to access to my app (that uses Anvard) to use social functionalities. The various API keys and secrets are all already setted on my hybridauth.php file inside the /config folder. If I try to use Anvard through a laravel route it works perfectly (that is I can login to Facebook, for example, and return the currently connected user's profile).

But if I want to call the same laravel's route outside of my app I encounter an error (a generic error among other things... "Oophs. Error!"). I have the following laravel's route:

$anvard = App::make('anvard');
$token = $anvard->attemptAuthentication('Facebook', App::make('hybridauth'));

What I do is call the laravel's route through CURL that is setted this way:

curl_setopt($curl, CURLOPT_URL, 'MyURL');
curl_setopt ($curl, CURLOPT_HEADER, 0);
curl_setopt ($curl, CURLOPT_TIMEOUT, 15);
curl_setopt ($curl, CURLOPT_VERBOSE, 0);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);

If I use these settings, the result is a blank page with no errors, but the execution of my code cannot go over the attemptAuthentication method. If I add the following two settings instead, i receive an error

curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_MAXREDIRS, -1);

Firstly I thought that it was a CURL problem, so I tried guzzle (Link) that is a client to make request and receive response. I've installed it through composer (the same as laravel and this anvard package). The result is the same, with the same error.

I've also used hybridauth apart, with the following code:

$hybridauth = App::make('hybridauth');
$adapter = $hybridauth->authenticate('Facebook');

Again, the result is the same.

And finally, the error returned is the following:

production.ERROR: exception 'Hybrid_Exception' with message 'Oophs. Error!' in C:\xampp\htdocs\bsssocial\vendor\hybridauth\hybridauth\hybridauth\Hybrid\Endpoint.php:212 Stack trace:#0

From what I can undestand, it is ad initialization problem... but I can't figure out why.

Can anyone help me, please?

Comments (2)

  1. Log in to comment