Key path oauth-private.key does not exist or is not readable Laravel Origin: Application & API Last updated 4 Nov 2026

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.

Exact message you may see 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
Seen on: Laravel PHP

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:keys never 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

  1. php artisan passport:keys
  2. Check ls -l storage/oauth-*.key and chown to the web user
  3. Provide keys through env variables in container deployments

Detailed fix by platform

Laravel

  1. php artisan passport:keys --force && sudo chown www-data storage/oauth-*.key

How to diagnose

  1. Files — oauth-private/public.key exist?
  2. Perms — Readable by web user?
  3. 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:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

403 This action is unauthorized — Laravel: Illuminate\Auth\Access\AuthorizationException: This action is unauthorized. (Laravel)403 This action is un…Attempt to read property "x" on null — Laravel/PHP 8: ErrorException: Attempt to read property "name" on null (Laravel)Attempt to read prope…Command "x" is not defined — Laravel: Symfony\Component\Console\Exception\CommandNotFoundException: Command "make:livewire" is not defined. Did you mean one of these? (Laravel)Command "x" is not de…Failed to serialize user into session — Passport.js: Error: Failed to serialize user into session (Authentication)Failed to serialize u…Laravel storage — Laravel: The stream or file "storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied (PHP)Laravel storageLaravel: Allowed memory size exhausted (request) — Laravel/PHP: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes) in vendor/laravel/framework (Laravel)Laravel: Allowed memo…The bootstrap/cache directory must be present and writable — Laravel: RuntimeException: The /var/www/bootstrap/cache directory must be present and writable. (Laravel)The bootstrap/cache d…Key path …

Explore the map of this error Full error map →

🧠 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.