Laravel API身份验证(Passport); CryptKey.php中的ErrorException

问题描述 投票:6回答:3

CryptKey.php第57行中的ErrorException:

密钥文件“file:// C:\ wamp \ www \ project \ public_html \ storage \ oauth-private.key”权限不正确,应为600或660而不是666

我的配置如下:

  • Windows 10 64位
  • WampServer 3.1.0
  • Apache 2.4.27
  • PHP 7.0.23
  • Laravel Framework版本5.3.31
  • 作曲家需要laravel / passport = ~1.0

知道怎么解决吗?

laravel laravel-passport
3个回答
7
投票

您可以在第57行关闭文件检查权限

你的CryptKey路径是vendor/league/oauth2-server/src/CryptKey.php

在第48行,将其变为false或评论你的CryptKey.php中的以下块

   if ($keyPermissionsCheck === true) {
        // Verify the permissions of the key
        $keyPathPerms = decoct(fileperms($keyPath) & 0777);
        if (in_array($keyPathPerms, ['600', '660'], true) === false) {
            trigger_error(sprintf(
                'Key file "%s" permissions are not correct, should be 600 or 660 instead of %s',
                $keyPath,
                $keyPathPerms
            ), E_USER_NOTICE);
        }
    }

keyPermissionsCheck将其设为假。

希望这可以帮助。


1
投票

简单地将oauth-private.key文件CHMOD到600或660.我看到你使用Windows,所以你可以按照this post中的指示来做到这一点。


0
投票

我有同样的问题,但这个文件CryptKey.php在我的项目中没有它

© www.soinside.com 2019 - 2024. All rights reserved.