Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTL Token must be int but string given #70

Closed
SkonWodrich opened this issue Aug 26, 2022 · 5 comments
Closed

TTL Token must be int but string given #70

SkonWodrich opened this issue Aug 26, 2022 · 5 comments
Labels

Comments

@SkonWodrich
Copy link

SkonWodrich commented Aug 26, 2022

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

@Spomky
Copy link
Member

Spomky commented Sep 1, 2022

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?

@SkonWodrich
Copy link
Author

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.

@Spomky
Copy link
Member

Spomky commented Sep 2, 2022

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

@SkonWodrich
Copy link
Author

yes, that would be a workaround.

If no one else has this error the issue is solved for me now.

Thank you Florent

@stale
Copy link

stale bot commented Nov 12, 2022

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.

@stale stale bot added the wontfix label Nov 12, 2022
@stale stale bot closed this as completed Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants