esbenp/lumen-api-oauth

Stuck on infinite loop

Opened this issue · 4 comments

nowy commented

I'm stuck on an infinite loop.
Cloned the repo exactly, entered my config details, but when I hit login, there is never a server response.
I have a feeling it's due to an unresolved promise. Another option is because I'm on localhost without an SSL certificate?

Hmmm.. I have no idea. I just cloned the repo and it worked fine. Was it the browser or server that was stuck?

Could you fix it? I have the same problem here.
I created a new lumen project, copied all the contents of your repo and then did composer update.

app.php:

<?php
return [
    'url' => 'http://localhost:8000',
    'key' => 'U<CdJu~T&.g/kR-NX55h]HfB+bb,b7Y*',
    'cipher' => 'AES-256-CBC'
];

.env:

APP_ENV=local
APP_DEBUG=true
APP_KEY=6uKr58Ejafz0SJ12jiBBKCZTPvzcX2iL

APP_LOCALE=en
APP_FALLBACK_LOCALE=en

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=apitest
DB_USERNAME=root
DB_PASSWORD=

AUTH_MODEL=App\Auth\User

CACHE_DRIVER=memcached
SESSION_DRIVER=memcached
QUEUE_DRIVER=database

Screenshot
After clicking the login Button all that happens is that the Call to /login is started and then just keep pending. Nothing ever happens! Weird is also after stopping php artisan serve the php process keeps running. So basically the whole webserver crashes when trying to login.

Can you help? :)

EDIT:
On further inspection: The problem is definitely Proxy/Guzzle related!
It seems like that this code is stuck in an infinite loop:

$guzzleResponse = $client->post(sprintf('%s/oauth/access-token', $config->get('app.url')), [
    'form_params' => $data
]);

Any ideas on this?

It seems like I got it to work (although I ran into some new problems): Somehow moving it into my xampp htdocs folder, creating a new vhost (choosing the /publicFolder as root for the vhost) and using some .com domain (incl. modified hostsfile obviously) fixed the problem.
For whatever reason guzzle seems to have problems with the standard laravel (??) localhost:8000 webserver.

Avoid using PHP built-in server php -S localhost:3000 -t public/
The built-in server doesn't support a second invocation, so hangs when proxy tries to obtain access-token via Guzzle.
reference https://bugs.php.net/bug.php?id=66690