0

i am trying to create api token for my apis when my API are run in postman I get this error

LogicException: Unable to read key from file file://C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-private.key in file C:\Users\vivek\pregent-app\vendor\league\oauth2-ser

I did some goggling and fount that I need to do

php artisan passport:keys

but when I do I am getting the following error

file_put_contents(C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-public.key): Failed to open stream: No such file or directory

inorder to clear this error I tried php artisan config:cache still I am getting same error how can I solve this

note I am using larvel 9

this is the error I am getting

 file_put_contents(C:\Users\vivek\pregent-app\app\Providers/../secrets/oauth\oauth-public.key): Failed to open stream: No such file or directory      

  at C:\Users\vivek\pregent-app\vendor\laravel\passport\src\Console\KeysCommand.php:54
     50▕                 file_put_contents($privateKey, Arr::get($keys, 'privatekey'));
     51▕             } else {
     52▕                 $key = RSA::createKey($this->input ? (int) $this->option('length') : 4096);
     53▕
  ➜  54▕                 file_put_contents($publicKey, (string) $key->getPublicKey());
     55▕                 file_put_contents($privateKey, (string) $key);
     56▕             }
     57▕
     58▕             $this->info('Encryption keys generated successfully.');

  1   C:\Users\vivek\pregent-app\vendor\laravel\passport\src\Console\KeysCommand.php:54
      file_put_contents()

  2   C:\Users\vivek\pregent-app\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:36
      Laravel\Passport\Console\KeysCommand::handle()

vivek kn
  • 107
  • 1
  • 18
  • 45

1 Answers1

-3

you can try these commands

php artisan optimize:clear

once your cache is clear then you can do this commands

php artisan
  • stilll getting that errror – vivek kn Dec 19 '22 at 06:22
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 21 '22 at 03:04