bshaffer / oauth2-server-php-docs

documentation for the oauth2-server-php library
231 stars 148 forks source link

Empty response from CURL request to token controller #115

Open muckee opened 5 years ago

muckee commented 5 years ago

Following the 'Step-By-Step Walkthrough' documentation, I am unable to complete the 'Setting up a token controller' step.

I have created the directory /my/web/directory/private_html/user-api. Within that folder I issued the following command:

$ composer require bshaffer/oauth2-server-php "^1.10"

The command executed successfully and I proceeded to create the following two files:

/my/web/directory/private_html/user-api/bootstrap/server.php /my/web/directory/private_html/user-api/src/Controller/token.php

I altered the require_once statement within token.php to read:

require_once __DIR__.'../../bootstrap/server.php';

In line with the adjustments I've made to the recommended file structure.

The application I'm developing is running on a live server, so I have created a symlink to token.php within the folder /my/web/directory/public_html/. The server runs nginx, which is configured to use this folder as the web root.

I have created the necessary tables and added the testclient:testpass credentials to the oauth_clients table by issuing the SQL statement suggested in the documentation:

INSERT INTO oauth_clients (client_id, client_secret, redirect_uri) VALUES ("testclient", "testpass", "http://fake/");

I then execute the following command from my server's console:

curl -u testclient:testpass http://my.website.url/token.php -d 'grant_type=client_credentials'

I do not see any kind of response whatsoever. There is no error message, but there is no token, either.

I have followed all of the setup instructions and, aside from re-arranging the file structure and assigning proper values to the database connection variables, I have made no alterations.