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

zar*_*pio 6 laravel laravel-passport

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

知道怎么解决吗?

Adn*_*taz 10

您可以在第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);
        }
    }
Run Code Online (Sandbox Code Playgroud)

keyPermissionsCheck 将其设置为false.

希望这可以帮助.