oauth2-server-bundle icon indicating copy to clipboard operation
oauth2-server-bundle copied to clipboard

Unable to read key from file

Open fd6130 opened this issue 3 years ago • 4 comments

PHP 8.1 Symfony 6.1

I got a strange error when trying to access /token api

Unable to read key from file /var/oauth/private.key

I have both public and private key in /var/oauth, and yet it keep prompt unable to read key error.

fd6130 avatar Jun 19 '22 08:06 fd6130

Yeah I have the same issue. Tried putting the key in root, still nothing

david-909 avatar Aug 16 '22 21:08 david-909

Can you try this :

  1. Put private.key and public.key in a config/jwt/ directory
  2. Reference them with the following instructions in league_oauth2_server.yaml file, under authorization_server and resource_server respectively.
private_key:          '%kernel.project_dir%/config/jwt/private.key'
public_key:           '%kernel.project_dir%/config/jwt/public.key'
  1. Check that the user running the web service, or php, has sufficient rights to read the private key, which is of course protected with a 600 mode.

thejoelinux avatar Aug 24 '22 08:08 thejoelinux

@thejoelinux Thank you man, it is working. I found a fix by putting the absolute path, but this is way better.

david-909 avatar Sep 11 '22 19:09 david-909

Sorry for not responding earlier, I totally missed this one. I'm going to have a look next week.

chalasr avatar Sep 11 '22 20:09 chalasr