Laravel Passport 学习整理 | Laravel China 社区 - 高品质的 Laravel 和 PHP 开发者社区

[Laravel Passport 学习整理 | Laravel China 社区 - 高品质的 Laravel 和 PHP 开发者社区]

四种模式使用总结

[file

](https://lccdn.phphub.org/uploads/images/201710/18/19415/F9fZcWO7Bj.png)

注意和备注说明

  • 请求前认证用户:比如我们在使用weibo和QQ第三方登录时,要求先登录weibo和qq后在授权。
  • code:有效期默认为十分钟。
  • redirect_uri:必须和创建client_id的redirect_uri一模一样,否则会错误,发送请求时可以不填该参数.
  • state:用来传递跳转链接跟其他参数,使用前encode一下传递。
  • url#hash参数传递 :原因说明

使用中的错误与解决办法

请求code时,弹出HTTP Basic认证框
[](https://lccdn.phphub.org/uploads/images/201710/18/19415/d4eadGVIrD.png)

[file

](https://lccdn.phphub.org/uploads/images/201710/18/19415/d4eadGVIrD.png)

用code获取access_token时,GuzzleHttp\Exception\ServerException (500)。

Server error: POST http://myhost/oauth/token resulted in a 500 Internal Server Error response: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydb5.5.oauth_clients' doesn't exist (SQL: select * from oau
[](https://lccdn.phphub.org/uploads/images/201710/18/19415/KCZO3sEDEh.png)

[file

](https://lccdn.phphub.org/uploads/images/201710/18/19415/KCZO3sEDEh.png)

用code获取access_token时,GuzzleHttp\Exception\ClientException (401)

Client error: POST http://myhost/oauth/token resulted in a 401 Unauthorized response: {"error":"invalid_client","message":"Client authentication failed"}
[](https://lccdn.phphub.org/uploads/images/201710/18/19415/fQdRqZgp8o.png)

[file

](https://lccdn.phphub.org/uploads/images/201710/18/19415/fQdRqZgp8o.png)

用code获取access_token时,GuzzleHttp\Exception\ClientException (400)

Client error: POST http://myhost/oauth/token resulted in a 400 Bad Request response:
{"error":"invalid_request","message":"The request is missing a required parameter, includes an invalid parameter value
[](https://lccdn.phphub.org/uploads/images/201710/18/19415/4JNXqP3XIx.png)

[file

](https://lccdn.phphub.org/uploads/images/201710/18/19415/4JNXqP3XIx.png)


Original url: Access

Created at: 2018-10-10 18:17:05

Category: default

Tags: none

请先后发表评论
  • 最新评论
  • 总共0条评论