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

Followed the Laravel installation and quick start, getting error: "Tymon\\JWTAuth\\JWTGuard::login(): Argument #1 ($user) must be of type Tymon\\JWTAuth\\Contracts\\JWTSubject #2237

Open
teckel12 opened this issue Jan 10, 2024 · 0 comments

Comments

@teckel12
Copy link

teckel12 commented Jan 10, 2024

Subject of the issue

Followed the Laravel installation and quick start, getting the error:

500 Internal Server Error

  • exception: "TypeError"
  • file: "/var/www/html/vendor/tymon/jwt-auth/src/JWTGuard.php"
  • line: 136
  • message: "Tymon\JWTAuth\JWTGuard::login(): Argument # 1 ($user) must be of type Tymon\JWTAuth\Contracts\JWTSubject, Illuminate\Auth\GenericUser given, called in /var/www/html/vendor/tymon/jwt-auth/src/JWTGuard.php on line 124"

To clarify, I do have the following in the Users.php model:
class User extends Authenticatable implements JWTSubject

Your environment

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 9.19
Package version ?
PHP version 8.0.30

Steps to reproduce

  1. Instal Laravel
  2. Connected to DB
  3. Created user table
  4. Follow the jwt-auth Laravel installation and quick start
  5. Attempt to sign on
  6. Get the above error

Expected behaviour

Return the reponse:

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ",
    "token_type": "bearer",
    "expires_in": 3600
}

Actual behaviour

500 error as outlined above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant