简体   繁体   English

尝试使用`oauth2-server-php`但令牌请求只是打印`token.php`的内容

[英]Trying to use `oauth2-server-php` but token request simply prints contents of `token.php`

I've been trying to figure out how to implement an OAuth2 server so that I can handle authorization for my API. 我一直在尝试弄清楚如何实现OAuth2服务器,以便可以处理API的授权。 I have read through the documentation for bshaffer's oauth2-server-php and tried following the step by step this guide 我已经阅读了bshaffer的oauth2-server-php文档,并尝试按照本指南的步骤进行操作

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. 它只是吐出文件token.php的内容,而不是实际返回访问令牌。

I modified the path http://localhost/oauth2/token.php to be the actual path to token.php as I have it installed. 我已将安装路径http://localhost/oauth2/token.php修改为token.php的实际路径。

Has anyone else experienced this or know what could be causing it? 有没有其他人经历过这种情况或知道是什么原因造成的?

Looks like short_open_tag issue. 看起来像short_open_tag问题。 Does the token.php file start with short tag? token.php文件是否以短标签开头? If so, change it to a long one ( <?php ) or enable short tags in php.ini . 如果是这样,请将其更改为长的( <?php )或在php.ini中启用短标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM