Composer can't install jwt-auth-bundle for symfony 6

jwt-auth-bundle: ~4.0
Symfony 6

Hello,

I am trying to setup auth0 with my new symfony 6 project and I had trouble installing the package for jwt.
As I looked into why I saw that it wasn’t officailly released for symfony 6 yet, but I have found pull request mentionning the fact that it should work and that on the github branche 5.x-dev the bundle should work with symfony 6.
The problem is that I haven’t found a way to install it through composer without having an error saying that my composer.json is requiring symfony 6 and that jwt-auth-bundle doesn’t support above 5.4.

If you have a solution to my problem, it would be greatly appreciated.

Hi @ArthurBoucard,

Welcome to the Auth0 Community!

Can you please share the full error messages you are seeing? Also links to the info you are referencing would be helpful.

Hi,

here is the error message when doing composer require auth0/jwt-auth-bundle:“~4.0”

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires auth0/jwt-auth-bundle ~4.0 -> satisfiable by auth0/jwt-auth-bundle[4.0.0].
    - auth0/jwt-auth-bundle 4.0.0 requires symfony/framework-bundle ^4.4 || ~5.1 -> found symfony/framework-bundle[v4.4.0, ..., v4.4.41, v5.1.0, ..., v5.4.8] but it conflicts with your root composer.json require (6.0.*).

I found a way to install the lib by specifiying the dev-5.x-dev with this command:
composer require auth0/jwt-auth-bundle:“dev-5.x-dev”

With this I don’t have the error message saying that my composer requires symfony 6+ but in config/package I still can’t find the jwt-auth.yml and in my .env I also don’t have the configuration options added even though in my composer.json and bundle.php I can see that the lib is installed.

Thanks for the additional info. I am going to reach out to the team and see if I can get some help on this one. Thanks!

1 Like

Hey @ArthurBoucard,

Thanks for your question, and thanks for the heads-up @dan.woda. So, as you noticed, Symfony 6 support isn’t quite ready yet — it’s untested and incomplete, and hasn’t gone through a security review. Lots of stuff will be broken, and importing that branch will result in further breaking changes manifesting as v5 evolves. For those reasons, I’d very strongly recommend against using it in any real application right now. Consider this pre-alpha stuff right now.

I am not sure why the config file wasn’t created for you during the composer require, but you can work around that by simply creating it yourself based on the example in the README. Like v4, your .env file needs to be updated manually to include your Auth0 configuration details.

1 Like

Thanks for your answer @evansims,

So if I create the file myself using the v4 syntax and everything I will be able to use auth0 with symfony 6 without all the problems you said or should I just give up the idea of using both together right now?

It depends on what you’re building, I’d say:

  • If you’re building something for production use — absolutely do not use that branch right now. We don’t support Symfony v6 for real world use with that SDK yet. You can watch the thread I linked for updates as we roll out a stable version.
  • If you’re building something to learn or are prototyping a concept — there’s no harm there, as long as real users won’t be using it. I’d pin to a commit rather than the branch, however, as breaking changes will inevitably happen with that development branch.

My tip would allow you to use that branch in your project, presumably, but does not negate the warnings I shared.

3 Likes