oauth2服务器laravel的问题


problems with oauth2-server-laravel

我是OAuth的新手。我正在努力实现https://github.com/lucadegasperi/oauth2-server-laravel#password-流量

我已经在oauth_clients表中插入了idsecret。此外,我已将用户名和密码插入到users表中。(通过Phpmyadmin)

在我尝试完成请求后:

POST http://localhost:8000/oauth/access_token?
grant_type=password&
client_id=weredfsdfsrq341&
client_secret=dfwefsdf&
username=test@test.com&
password=123456

但回应是:

{
error: "invalid_request"
error_description: "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "client_id" parameter."
}

我的路线是

Route::post('oauth/access_token', function()
{
    return AuthorizationServer::performAccessTokenFlow();
});

我做错了什么?

不确定你是否找到了答案,但是,这是这里讨论的包中的一个错误

基本上,当内容类型为json时,包不会正确处理参数。修复:在vendor/lucadegaperi/oauth-server laravel/src/OAuth2ServerServiceProvider.php中查找$authorizer->setRequest($app['request']);并在其上方添加此行

 $app['request']->replace('Input::all());

进行POST时,请确保内容类型设置为"x-www-form-urlencoded"。

我可能错了,但我认为您错过了参数scope。只是猜测。