Client credentials can be empty using grant type "ClientCredentials"
When using grant type ClientCredentials, a token is granted even if client_id and client_secret are empty.
A couple of possible situations:
- when providing correct client_id and client_secret, a token is granted, this is correct behaviour.
- when providing incorrect client_id and client_secret, no token is granted, this is correct behaviour.
- when providing no client_id and client_secret, a token is granted, this seems incorrect behaviour to me.
There is no row with empty client_id and client_secret in our oauth_clients table.
Some further info: we use Pdo as the storage type.
In the function checkClientCredentials, no client is found in the database. This means that $result['client_secret'] will also be empty which leads to the fact that the check return $result['client_secret'] == $client_secret; evaluates to true.
Hi @jversmis,
Did you install the correct version of the oauth server or make some modifications to the php code of the oauth server ?
Just tried using curl without client credentials :
curl http://someIP/my-oauth2-walkthrough/token.php -d 'grant_type=client_credentials'
and the following error is received in the response:
{"error":"invalid_client","error_description":"Client credentials were not found in the headers or body"}
No token is granted, it is the correct behaviour.
I do not believe this is a valid issue. See these lines:
https://github.com/bshaffer/oauth2-server-php/blob/develop/src/OAuth2/Storage/Pdo.php#L83
https://github.com/bshaffer/oauth2-server-php/blob/develop/src/OAuth2/ClientAssertionType/HttpBasic.php#L46