Unable to read key from file
fd6130 opened this issue · 4 comments
fd6130 commented
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.
david-909 commented
Yeah I have the same issue. Tried putting the key in root, still nothing
thejoelinux commented
Can you try this :
- Put
private.key
andpublic.key
in aconfig/jwt/
directory - Reference them with the following instructions in
league_oauth2_server.yaml
file, underauthorization_server
andresource_server
respectively.
private_key: '%kernel.project_dir%/config/jwt/private.key'
public_key: '%kernel.project_dir%/config/jwt/public.key'
- 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.
david-909 commented
@thejoelinux
Thank you man, it is working. I found a fix by putting the absolute path, but this is way better.
chalasr commented
Sorry for not responding earlier, I totally missed this one. I'm going to have a look next week.