找不到护照 laravel createToken 个人访问客户端
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55168808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Passport laravel createToken Personal access client not found
提问by DavidInTheIn
After setup of passport, I have configured and created a controller to manage Register-Login- and - access to a resource for a general external post request. I do not need for a specific client. But when I try to create a token in the registration or in the login:
设置通行证后,我已经配置并创建了一个控制器来管理注册-登录-和-访问一般外部发布请求的资源。我不需要特定的客户。但是当我尝试在注册或登录中创建令牌时:
$tokenObj=$user->createToken('APPLICATION')->accessToken;
The error is:
错误是:
RuntimeException: Personal access client not found. Please create one. in file C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\ClientRepository.php on line 94 Stack trace: 1. RuntimeException->() C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\ClientRepository.php:94 2. Laravel\Passport\ClientRepository->personalAccessClient() C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\PersonalAccessTokenFactory.php:71
RuntimeException: 未找到个人访问客户端。请创建一个。在文件 C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\ClientRepository.php 中的第 94 行堆栈跟踪: 1. RuntimeException->() C:\xampp7.1\htdocs\passport\vendor\ laravel\passport\src\ClientRepository.php:94 2. Laravel\Passport\ClientRepository->personalAccessClient() C:\xampp7.1\htdocs\passport\vendor\laravel\passport\src\PersonalAccessTokenFactory.php:71
How can I solve it?
我该如何解决?
采纳答案by namelivia
回答by Ruberandinda Patience
for me it solved by running
对我来说它通过运行解决了
php artisan passport:install
because it have been happened after refreshing my database.
因为它是在刷新我的数据库后发生的。
回答by Russell Sk.
In addition to the namelivia's comment. As Laravel doc says:
除了namelivia的评论。正如 Laravel 文档所说:
Before your application can issue personal access tokens, you will need to create a personal access client. You may do this using the passport:client command with the --personal option. If you have already run the passport:install command, you do not need to run this command:
在您的应用程序可以发布个人访问令牌之前,您需要创建一个个人访问客户端。您可以使用带有--personal 选项的passport:client 命令执行此操作。如果您已经运行过passport:install 命令,则不需要运行此命令:
php artisan passport:client --personal
But if you did not run the command:
但是如果你没有运行命令:
php artisan passport:install
You should run it first.
你应该先运行它。