I'm wanting to put a secret pass_phrase value (0000) into .env.dev.local file (for lexik_jwt_authentication), but the authentication wasn't working.
If I put the value directly into the file config/packages/lexik_jwt_authentication.yaml, authentication works.
# composer.json
"symfony/dotenv": "^4.2",
# config/packages/lexik_jwt_authentication.yaml
lexik_jwt_authentication:
pass_phrase: '%env(JWT_PASSPHRASE)%'
# .env.dev.local
JWT_PASSPHRASE='0000'
# .env
JWT_PASSPHRASE=''
To debug this, I edited vendor/lexik/jwt-authentication-bundle/DependencyInjection/LexikJWTAuthenticationExtension.php as follows to see what's going on:
# vendor/lexik/jwt-authentication-bundle/DependencyInjection/LexikJWTAuthenticationExtension.php
var_dump($config['pass_phrase']);
die('end of the story');
$container->setParameter('lexik_jwt_authentication.pass_phrase', $config['pass_phrase']);
The shown value is :
env_6a2d2290a3aa88de_resolve_JWT_PASSPHRASE_15ef1bcee0c9b69d171abe271c686aa8
The documentation https://symfony.com/doc/master/configuration/environment_variables.html is clear and pretty easy about this, first defining a value into the dot envs (DATABASE_URL), then using it into the config files '%env(DATABASE_URL)%'.
How do I fix this and why I'm having this value?