Configuring OAuth2 in Lumen
I followed this article written to set up OAuth2 for my API that I am writing to Lumen
. I finished setting up and I implemented the client to test that it works. I haven't been able to get it to work. When I click on the "Login to API" button, it sends a POST to http://myserver.com/login
and it never ends. It hangs here and I am not getting any exceptions or errors. Also, when it freezes, I can't just refresh the page. I have to serve it on a different port if that's the key to what's going on. I was outputting a bunch of log messages and I narrowed the problem down to this:
$guzzleResponse = $client->post(sprintf('%s/oauth/access-token', $config->get('app.url')), [
'body' => $data
]);
I have checked the parameters and they look good. $client
is a client GuzzleHttp
. 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 might have to enable cookies in Lumen. Where will I go to find out? Does anyone have any other ideas?
source to share