TTL Token must be int but string given
SkonWodrich opened this issue · comments
Version(s) affected: v3.0.3
Description
in my .env i got:
###> lexik/jwt-authentication-bundle ### JWT_PASSPHRASE=xxxxxxxxxxxxxxxxxxxxx JWT_REFRESH_TTL=2592000 # one month JWT_TTL=86400 # 1 day
in my "spomky_labs_lexik_jose_bridge_bundle.yaml" i got:
ttl: '%env(int:JWT_TTL)%'
when i start a composer install i get:
Invalid type for path "lexik_jose.ttl". Expected "int", but got "string".
How to reproduce
install the package and try to set the TTL in spomky_labs_lexik_jose_bridge_bundle.yaml via a .env var
Hi,
I don't know how to help. The way Symfony inject the processed env vars is quite obscure to me.
I have never had issues with int:
in the past.
Why would you need to configure TTL through env vars?
Hello, and thank you for the answer. I have deploymentpipelines wich sets several values dynamic. there are differnet values for prod an dev e.g.
Symfony already supports different configuration values depending on the env. You just have to adapt it depending on the use case.
# default TTL is 1 day
lexik_jose:
ttl: 86400
...
# TTL=1hr only in the "prod" environment
when@prod:
lexik_jose:
ttl: 3600
# TTL=10 mins only in the "test" environment
when@test:
lexik_jose:
ttl: 600
# TTL=30 mins only in the "staging" environment (custom env)
when@staging:
lexik_jose:
ttl: 1800
Dynamic values are not supported here
yes, that would be a workaround.
If no one else has this error the issue is solved for me now.
Thank you Florent
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.