Laravel Passport: LogicException: Key path "file:///var/www/storage/oauth-private.key" does not exist or is not readable
Passport can't find or read its OAuth signing keys.
Key path "file:///var/www/storage/oauth-private.key" does not exist or is not readableLogicException: Key path does not exist or is not readableoauth-private.key does not exist or is not readablePassport keys missingKey path oauth-public.key does not exist Meaning
Generate keys with php artisan passport:keys (or passport:install), ensure they're in storage/ (not git-committed) and readable by the web user with correct permissions (600/660). On deploy, keys must be present or supplied via PASSPORT_PRIVATE_KEY/PASSPORT_PUBLIC_KEY env vars.
Common causes
passport:keysnever run on this server- Keys not copied by the deploy
- Permissions/ownership wrong
- Keys wiped by clean deploy
- Env var contains wrong line breaks
⚡ Quick fix
php artisan passport:keys- Check
ls -l storage/oauth-*.keyand chown to the web user - Provide keys through env variables in container deployments
Detailed fix by platform
Laravel
php artisan passport:keys --force && sudo chown www-data storage/oauth-*.key
How to diagnose
- Files — oauth-private/public.key exist?
- Perms — Readable by web user?
- Deploy — Preserved?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 403 This action is unauthorized Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized.
- Attempt to read property "x" on null Laravel/PHP 8: ErrorException: Attempt to read property "name" on null
- Command "x" is not defined Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these?
Most viewed in Laravel
- MassAssignmentException Laravel: Illuminate\Database\Eloquent\MassAssignmentException: Add [x] to fillable property to allow mass assignment
- The GET method is not supported for route Laravel: The GET method is not supported for route x. Supported methods: POST (MethodNotAllowedHttpException)
- Route [login] not defined Laravel: Symfony\Component\Routing\Exception\RouteNotFoundException: Route [login] not defined
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026