我已经按照文档安装了 Laravel Passport,并且修改了所有需要的代码区域。
我正在设置密码授予令牌,以便用户在使用网站的用户名和密码登录时能够获得 API 令牌。不过,当涉及到 grant_type 时,我遇到了一个问题。出于某种原因,Laravel 抱怨授权类型无效。
{
"error": "unsupported_grant_type",
"message": "The authorization grant type is not supported by the authorization server.",
"hint": "Check the `grant_type` parameter"
}
这些是我发布到的字段/oauth/token
client_id = 4
client_secret = SMiYE7XqDNtXKQnmkYmFnXxfAaV83vRhnJ9zwCtZ
username = jcrawford@domain.com
password = **************
grant_type = password
scope = *
我跑过php artisan passport:install
,我也试过跑步php artisan passport:client --password
这两个命令都有效并且都创建了客户端和机密,但是,我似乎无法克服有关 grant_type 的错误。
关于我应该看什么来解决这个问题的任何建议,以便密码授予令牌对我有用?