0

I've been trying to figure out how to implement an OAuth2 server so that I can handle authorization for my API. I have read through the documentation for bshaffer's oauth2-server-php and tried following the step by step this guide

But when I run

curl -u testclient:testpass http://localhost/oauth2/token.php \
     -d grant_type=client_credentials'

it simply spits out the contents of the file token.php rather than actually return an access token.

I modified the path http://localhost/oauth2/token.php to be the actual path to token.php as I have it installed.

Has anyone else experienced this or know what could be causing it?

raviolicode
  • 2,155
  • 21
  • 22
user3353762
  • 103
  • 1
  • 2
  • 13
  • was this a typo? `curl -u testclient:testpass http://localhost/oauth2/token.php -d grant_type=client_credentials'` missing a single quote – Madness Aug 07 '15 at 20:37
  • Have you confirmed that your web server and environment are installed properly? This sounds like your web server is just giving you the document instead of processing it with PHP. Try accessing another simpler php file to make sure everything is working ok. – nbering Aug 07 '15 at 21:52

1 Answers1

0

Looks like short_open_tag issue. Does the token.php file start with short tag? If so, change it to a long one (<?php) or enable short tags in php.ini.

Community
  • 1
  • 1
Vasily
  • 1,858
  • 1
  • 21
  • 34
  • THANK YOU! I can't believe it but I didn't even HAVE php tags on the page. Giant facepalm. Seriously, I spent hours trying to figure it out. I can't believe I didn't put tags on the page >. – user3353762 Aug 07 '15 at 21:44