bshaffer / oauth2-server-php-docs

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

Fix curl command #76

Closed delboy1978uk closed 8 years ago

delboy1978uk commented 8 years ago

the original command returned: {"error":"invalid_client","error_description":"The client credentials are invalid"}

bshaffer commented 8 years ago

Both method are valid ways of authenticating with client credentials.

delboy1978uk commented 8 years ago

Hi Brent Thanks for getting back :-)

For some reason all I got when doing it the original way was the 'invalid_client' response mentioned above.

Please note though my OAuth pages are on a VM, whilst the curl command I ran was from my Mac Terminal.

Possibly the Mac build of curl is implemented differently? I'm not sure, however if the command I ended up running will work on any curl, then maybe we should use that instead?

Great work btw, cheers! Derek

bshaffer commented 8 years ago

It's probably because PHP does not include HTTP_AUTHORIZATION in the $_SERVER array by default (see this fix). Something like this might work:

if (isset(getallheaders()['Authorization'])) {
    $_SERVER['HTTP_AUTHORIZATION'] = getallheaders()['Authorization'];
}

I may try to add support for this directly in the library, since the current solution apparently is not enough.