laravel - 如何在laravel中使用护照检索访问令牌?
问题描述
我只是按照Laravel 官方中的步骤进行操作。
我正在使用邮递员发送发布请求(http://localhost:7777/my-project/public/oauth/token),因此我可以检索访问令牌:
{
"grant_type" : "password",
"client_id" : "2",
"client_secret" : "oxKBv6EnyEXeF6l4FBbkVcLgq2WPnyB9EOdlUpL5",
"username" : "my_email",
"password" : "my_password",
"scope" :""
}
我收到此错误:
{"error":"invalid_credentials","message":"The user credentials were incorrect."}
即使我确定我的凭据是正确的。
解决方案
您的客户端必须设置为密码授权客户端才能使用密码授权:
https://laravel.com/docs/5.5/passport#creating-a-password-grant-client
普通客户端没有启用密码授权。
推荐阅读
- ms-access - 使用 2 个字段的 MS Access 完全外部联接?
- c# - 如何在 MVC 5 中使用 DropdownListFor 在多个 DropDownList 中选择值
- javascript - JavaScript 基于浏览器语言重定向用户(Chrome 扩展)
- xpath - 如何在 XPath 中使用多个 OR 运算符
- javascript - 从状态中引用状态 - React js
- react-native - 第一个 Expo 项目在 npm start 后抛出错误
- c# - 在路由中隐藏 URL 数据/值
- android - 渲染到屏幕外视图并保存屏幕截图
- c# - 如何解析看起来像这样的 DateTime:'Date(1543396029630)'
- c# - 构建复杂数据类