Reputation: 1983
I followed this article written to setup OAuth2 for my API that I'm writing in Lumen
. I finished setting it up and I implemented the client so that I could test that it works. I haven't been able to get it to work. When I click the 'Login to API' button, it sends a POST to http://myserver.com/login
and it never finishes. It hangs here and I get no exceptions or errors of any kind. Also, when it hangs like that I cannot just refresh the page. I have to serve it on another port, if that's a clue as to what's happening. I output a bunch of log messages and I've narrowed the trouble down to this:
$guzzleResponse = $client->post(sprintf('%s/oauth/access-token', $config->get('app.url')), [
'body' => $data
]);
I checked the parameters and they look good. $client
is a GuzzleHttp
Client. The post method inside looks like this:
public function post($url = null, array $options = [])
{
return $this->send($this->createRequest('POST', $url, $options));
}
I think I may have to enable cookies in Lumen. Where would I go to find that out? Does anyone have any other ideas?
Upvotes: 4
Views: 2050
Reputation: 658
Sometimes Guzzle doesnot work with port eg localhost:8888. If you are runnnig your server on some port change it to default 80 and guzzle will work
Upvotes: 0
Reputation: 4315
To enable cookie, you can do this in .env file -
SESSION_DRIVER=cookie
Then run composer update
command.
Upvotes: 2
Reputation: 674
Had you check your .env?.. please add AUTH_MODEL=App\Auth\User if that no there.
Upvotes: 0