Problems installing tymon jwt auth in Laravel 9

Viewed 3339

Please I'm having issue installing in Laravel 9. I don't know may be tymon jwt auth is not yet compactible with Laravel 9. This is the error I'm getting below.

When I ran composer require tymon/jwt-auth:

Problem 1
- Root composer.json requires tymon/jwt-auth ^0.5.12 -> satisfiable by tymon/jwt-auth[0.5.12].
- tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require tymon/jwt-auth:*" to figure out if any version is installable, or "composer require tymon/jwt-auth:^2.1" if you know which you need.

When I ran composer require tymon/jwt-auth "^1.0":

Problem 1
- tymon/jwt-auth dev-develop requires illuminate/auth ^5.2|^6|^7|^8 -> found illuminate/auth[v5.2.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
- tymon/jwt-auth 1.0.0-alpha1 requires illuminate/auth 5.1.* || 5.2.* -> found illuminate/auth[v5.1.1, ..., 5.2.x-dev] but these were not loaded, likely because it conflicts with another require.
- tymon/jwt-auth[1.0.0-alpha.2, ..., 1.0.0-rc.4.1] require php ^5.5.9 || ^7.0 -> your php version (8.1.1) does not satisfy that requirement.
- tymon/jwt-auth[1.0.0-rc.5, ..., 1.0.2] require php ^5.5.9|^7.0 -> your php version (8.1.1) does not satisfy that requirement.
- tymon/jwt-auth 1.0.x-dev is an alias of tymon/jwt-auth dev-develop and thus requires it to be installed too.
- Root composer.json requires tymon/jwt-auth ^1.0 -> satisfiable by tymon/jwt-auth[1.0.0-alpha1, ..., 1.0.x-dev (alias of dev-develop)].

When I ran composer require tymon/jwt-auth:"dev-develop":

Problem 1
- Root composer.json requires tymon/jwt-auth dev-develop -> satisfiable by tymon/jwt-auth[dev-develop].
- tymon/jwt-auth dev-develop requires illuminate/auth ^5.2|^6|^7|^8 -> found illuminate/auth[v5.2.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.

When I ran composer require tymon/jwt-auth:*

    - tymon/jwt-auth[dev-dependabot/composer/yoast/phpunit-polyfills-tw-1.0.0, dev-dependabot/add-v2-config-file, dev-develop, 1.0.x-dev] require illuminate/auth ^5.2|^6|^7|^8 -> found illuminate/auth[v5.2.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - tymon/jwt-auth 2.0.x-dev requires php ^7.4 -> your php version (8.1.1) does not satisfy that requirement.
    - tymon/jwt-auth[0.1.0, ..., 0.3.6] require illuminate/support 4.2.* -> found illuminate/support[v4.2.0-BETA1, ..., 4.2.x-dev] but these were not loaded, likely because it conflicts with another require.
    - tymon/jwt-auth[0.3.7, ..., 0.4.3] require illuminate/support ~4.0 -> found illuminate/support[v4.0.0-BETA2, ..., 4.2.x-dev] but these were not loaded, likely because it conflicts with another require.
    - tymon/jwt-auth[dev-master, 0.5.0, ..., 0.5.12] require illuminate/support ~5.0 -> found illuminate/support[v5.0.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
    - tymon/jwt-auth 1.0.0-alpha1 requires illuminate/auth 5.1.* || 5.2.* -> found illuminate/auth[v5.1.1, ..., 5.2.x-dev] but these were not loaded, likely because it conflicts with another require.
    - tymon/jwt-auth[1.0.0-alpha.2, ..., 1.0.0-rc.4.1] require php ^5.5.9 || ^7.0 -> your php version (8.1.1) does not satisfy that requirement.
    - tymon/jwt-auth[1.0.0-rc.5, ..., 1.0.2] require php ^5.5.9|^7.0 -> your php version (8.1.1) does not satisfy that requirement.
    - tymon/jwt-auth 1.0.x-dev is an alias of tymon/jwt-auth dev-develop and thus requires it to be installed too.
    - Root composer.json requires tymon/jwt-auth * -> satisfiable by tymon/jwt-auth[dev-dependabot/composer/yoast/phpunit-polyfills-tw-1.0.0, dev-dependabot/add-v2-config-file, dev-master, dev-develop, 0.1.0, ..., 0.5.12, 1.0.0-alpha1, ..., 1.0.x-dev (alias of dev-develop), 2.0.x-dev].```
2 Answers

An update of composer.json is missing

I used this:

composer require tomfordrumm/jwt-auth:dev-develop

tymon/jwt-auth is no more compatible with Laravel 9, I faced same issue and I fixed it by :

Deleting composer.lock file and remove tymon/jwt-auth from "composer.json" packages object,

then do following steps:

composer install

After composer install Run "composer require php-open-source-saver/jwt-auth"

Run: php artisan vendor:publish --provider="PHPOpenSourceSaver\JWTAuth\Providers\LaravelServiceProvider"

NOTE: Do rest of JWT auth configurations

Related