2019独角兽企业重金招聘Python工程师标准>>>
在使用token的出现错误
{
"name": "Unauthorized",
"message": "Your request was made with invalid credentials.",
"code": 0,
"status": 401,
"type": "yii\\web\\UnauthorizedHttpException"
}
很可能是由于apache服务器上需要配置.htaccess文件,要加上一行:
SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1
Options +FollowSymLinksIndexIgnore */*RewriteEngine on# if a directory or a file exists, use it directlyRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d# otherwise forward it to index.phpRewriteRule . index.phpSetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1