[英]Laravel passport authentication and token generation
I am new to Laravel, just started building REST APIs. 我是Laravel的新手,刚刚开始构建REST API。 I have started from creating login and registration APIs.
我从创建登录和注册API开始。 For user authentication, I have used PASSPORT of Laravel.
为了进行用户身份验证,我使用了Laravel的PASSPORT。 I have performed a number of steps defined at https://laravel.com/docs/5.4/passport#installation .
我已经执行了https://laravel.com/docs/5.4/passport#installation定义的许多步骤。 Everything is going well expect core functionality.
一切进展顺利,期待核心功能。 I have migrated tables, I am able to see routes list by
$ php artisan route:list
. 我已经迁移了表格,可以通过
$ php artisan route:list
查看路线$ php artisan route:list
。 But I am facing issue at where I am trying to generate a token with the help of oauth/token
. 但是我在尝试借助
oauth/token
生成令牌时遇到了问题。
This is the POST data what I am sending to 这是我要发送到的POST数据
127.0.0.1:8000/oauth/token
{
"client_id": 2, //from oauth_clients table
"client_secret": "XcYUuFDOtWByLPOdrQbW5rEf9tWBqoToPgJVAA3L", //from oauth_clients table
"grant_type": "password",
"username": "adnmin@test.com", //saved in users table
"password": "$2y$10$4fJz1/DA2mFg.McFfCqrkuXm1/wojQQh3eM4EEkbLjclGb4nETRy2", //saved in users table
"scope": "*"
}
I am continually getting invalid_credinatials . 我不断收到invalid_credinatials 。 I am not able to understand what is the parameter to be sent to the place of username and password.
我无法理解要发送到用户名和密码位置的参数是什么。
保存在数据库中的密码采用加密形式,因此您必须在此处输入实际密码,因为Laravel会自动加密您的密码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.