Laravel API 身份验证(护照); CryptKey.php 中的错误异常

Laravel API Authentication (Passport); ErrorException in CryptKey.php

CryptKey.php 第 57 行出现错误异常:

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

我的配置如下:

知道如何解决吗?

您可以在第 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 将其设置为 false。

希望这对您有所帮助。

只需将 oauth-private.key 文件更改为 600 或 660。我看到您使用 Windows,因此您一定可以按照 this post 中的说明进行操作。