Laravel 5.3护照无效

时间:2017-06-28 13:48:00

标签: php laravel-5.3 laravel-passport

我是Laravel Passport的新手,并使用官方文档进行安装和配置。

public function register(){
    $password = Hash::make('demo');
    $user = DB::table('users')->insertGetId([
          'name'     => 'User',
          'email'    => 'userdev@gmail.com',
          'password' => $password,
        ]);

     // create oauth client
    $oauth_client = \App\OauthClient::create([
        'user_id'                => $user,
        'name'                   => 'User',
        'secret'                 => base64_encode(hash_hmac('sha256',$password, 'secret', true)),
        'password_client'        => 1,
        'personal_access_client' => 0,
        'redirect'               => '',
        'revoked'                => 0,
    ]);

    $response = ['status'=>200,'message'=>'Successfully Registered'];
    return $response;

我只是运行API throgh postman并将其响应为成功注册

之后,我只是调用 http://localhost/passport/oauth/token 路由来验证用户身份。但它不起作用。它的回归就像..

Postdata:

grant_type:password
client_id :1
client_secret:j7q0ky8chHQ0RHJFpWo4Lqn/hl7Z0ntzYeyzsXE9ULA=
username:userdev@gmail.com
password:demo
scope:

回应:

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

2 个答案:

答案 0 :(得分:0)

确保它被放置在体内而不是参数中。

答案 1 :(得分:0)

仍然不确定为什么,但是运行php artisan config:clear为我解决了这个问题。