bshaffer / oauth2-server-php-docs

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

User credentials grant incompatible with the oauth_clients table constraints #37

Open bshaffer opened 10 years ago

bshaffer commented 10 years ago

from @jgoux

Hello, I want to implement the User credentials grant with your library (which is excellent :D) I have an issue with the constraints set on the oauth_clients table. In the doc, you give this query to create the oauth_clients table :

CREATE TABLE oauth_clients (client_id VARCHAR(80) NOT NULL, client_secret VARCHAR(80) NOT NULL, redirect_uri VARCHAR(2000) NOT NULL, grant_types VARCHAR(80), scope VARCHAR(100), user_id VARCHAR(80), CONSTRAINT client_id_pk PRIMARY KEY (client_id));

As my client is public, I don't need to associate a client_secret to it, and as I want to use the User credentials grant, I don't need to set a redirect_uri either. So maybe client_secret and redirect_uri don't need the NOT NULL constraint by default.

ghost commented 6 years ago

Maybe I'm misunderstanding the oAuth protocol or the implementation this library offers, so please correct me if I'm wrong.

I thought the oauth_users table is intended for the user credentials grant, not oauth_clients.

What I am wondering is if oauth_clients (used for the client credentials grant) should have a redirect_uri field in the first place. It only seems to be used in the Authorization Code grant type.