@ahmdsaza Please verify if you have specified the APP_KEY to the Heroku credentials(Basically where you have defined all your env variables).
Aug 5, 2024
11
Level 1
Problem with: "Invalid key supplied", exception: "LogicException" (Laravel v10.26.2)
I had a problem, when I deploy my project into Heroku I try to register but this error comes out I try all solving I search for but doesn't help me, I use php artisan:migrate, php artisan passport:keys and php artisan passport:install --force, but no one help :(
{message: "Invalid key supplied", exception: "LogicException",…}
exception: "LogicException"
file: "/app/vendor/league/oauth2-server/src/CryptKey.php"
line: 67
message: "Invalid key supplied"
public function __construct($keyPath, $passPhrase = null, $keyPermissionsCheck = true)
{
$this->passPhrase = $passPhrase;
if (\strpos($keyPath, self::FILE_PREFIX) !== 0 && $this->isValidKey($keyPath, $this->passPhrase ?? '')) {
$this->keyContents = $keyPath;
$this->keyPath = '';
// There's no file, so no need for permission check.
$keyPermissionsCheck = false;
} elseif (\is_file($keyPath)) {
if (\strpos($keyPath, self::FILE_PREFIX) !== 0) {
$keyPath = self::FILE_PREFIX . $keyPath;
}
if (!\is_readable($keyPath)) {
throw new LogicException(\sprintf('Key path "%s" does not exist or is not readable', $keyPath));
}
$this->keyContents = \file_get_contents($keyPath);
$this->keyPath = $keyPath;
if (!$this->isValidKey($this->keyContents, $this->passPhrase ?? '')) {
throw new LogicException('Unable to read key from file ' . $keyPath);
}
} else { // ***** line 67 *****
throw new LogicException('Invalid key supplied');
}
if ($keyPermissionsCheck === true) {
// Verify the permissions of the key
$keyPathPerms = \decoct(\fileperms($this->keyPath) & 0777);
if (\in_array($keyPathPerms, ['400', '440', '600', '640', '660'], true) === false) {
\trigger_error(
\sprintf(
'Key file "%s" permissions are not correct, recommend changing to 600 or 660 instead of %s',
$this->keyPath,
$keyPathPerms
),
E_USER_NOTICE
);
}
}
}
I want to find what's is the problem because I try to solve it for a week
Please or to participate in this conversation.