【问题标题】:Laravel 5.3 Passport is not workingLaravel 5.3 护照不工作
【发布时间】:2017-12-01 22:18:05
【问题描述】:

我是 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,它的响应为 成功注册

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

邮政数据:

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"
} 

【问题讨论】:

    标签: php laravel-5.3 laravel-passport


    【解决方案1】:

    确保将其放置在正文中而不是参数中。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 2017-03-06
        • 2017-01-24
        • 2017-01-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-23
        • 2017-02-16
        相关资源
        最近更新 更多