invalid_grant 密码 grant_type Laravel 护照
invalid_grant for password grant_type Laravel Passport
我正在尝试为我的 API 创建一个 access_token,但我遇到了显示此消息的问题:
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
这是我的请求数据:
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E"
}
这是我的 oauth_clients table:
您需要在请求正文中发送以下内容。
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E"
}
正在使用以下方法从请求正文中验证客户端凭据。
// League\OAuth2\Server\Grant\AbstractGrant
// line 253
protected function getClientCredentials(ServerRequestInterface $request)
{
[$basicAuthUser, $basicAuthPassword] = $this->getBasicAuthCredentials($request);
$clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser); // It is fetching from request body
if (\is_null($clientId)) {
throw OAuthServerException::invalidRequest('client_id');
}
$clientSecret = $this->getRequestParameter('client_secret', $request, $basicAuthPassword);
if ($clientSecret !== null && !\is_string($clientSecret)) {
throw OAuthServerException::invalidRequest('client_secret');
}
return [$clientId, $clientSecret];
}
您尝试在您的请求数据中添加 scope
。
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E",
"scope" => ""
}
如果你有任何问题,请告诉我。
我正在尝试为我的 API 创建一个 access_token,但我遇到了显示此消息的问题:
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
这是我的请求数据:
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E"
}
这是我的 oauth_clients table:
您需要在请求正文中发送以下内容。
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E"
}
正在使用以下方法从请求正文中验证客户端凭据。
// League\OAuth2\Server\Grant\AbstractGrant
// line 253
protected function getClientCredentials(ServerRequestInterface $request)
{
[$basicAuthUser, $basicAuthPassword] = $this->getBasicAuthCredentials($request);
$clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser); // It is fetching from request body
if (\is_null($clientId)) {
throw OAuthServerException::invalidRequest('client_id');
}
$clientSecret = $this->getRequestParameter('client_secret', $request, $basicAuthPassword);
if ($clientSecret !== null && !\is_string($clientSecret)) {
throw OAuthServerException::invalidRequest('client_secret');
}
return [$clientId, $clientSecret];
}
您尝试在您的请求数据中添加 scope
。
{
"username":"neal.jacobi@example.org",
"password":"test1234",
"grant_type":"password",
"client_id": "2",
"client_secret":"jScq3DMMeZctypnYb7f1ClEHyzybwTK1Yisqo09E",
"scope" => ""
}
如果你有任何问题,请告诉我。