【发布时间】:2019-04-25 12:17:18
【问题描述】:
我似乎无法弄清楚这一点,我也是 Laravel 新手 - 所以可能找错地方了。我已经在我的计算机上通过 repo 建立了一个新站点,并且一切都正确编译,但我无法解决 OAuth 错误。该网站是一个用户仪表板,我需要能够登录才能查看其他页面。
当我打开网站时,我在控制台中看到以下错误:
Uncaught (in promise) Failed to re-authenticate user
当我尝试使用我的凭据登录时,我看到:
VM38:1 POST http://127.0.0.1:8000/oauth/token 500 (Internal Server Error)
我查看了我的 Laravel 日志并看到以下消息:
local.ERROR: Key path "file:///home/vagrant/code/storage/oauth-private.key" does not exist or is not readable {"exception":"[object] (LogicException(code: 0): Key path \"file:///home/vagrant/code/storage/oauth-private.key\" does not exist or is not readable at /home/vagrant/code/vendor/league/oauth2-server/src/CryptKey.php:45)
当我最初设置站点时,我成功运行了:
composer install
php artisan migrate
并生成一个新的 OAuth 密钥:artisan passport:client --password。
无法弄清楚如何解决令牌错误。
【问题讨论】:
-
安装后是否运行
php artisan key:generate?如果这是真的,您是否也运行了php artisan passport:install? -
我运行了
artisan passport:install,并看到了我的密钥文件生成,但是当我尝试登录时收到401 unauthorized错误。
标签: laravel login oauth vagrant homestead