tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.29k stars 1.54k forks source link

Type error: Argument 2 passed to __construct() must be an instance of App\Domain\Admin, instance of App\Domain\User given #1720

Open solegs opened 5 years ago

solegs commented 5 years ago

Type error: Argument 2 passed to __construct() must be an instance of App\Domain\Admin, instance of App\Domain\User given

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 5.6
Package version 0.5.12
PHP version 7.1

Bug only on testing (phpunit 6.5.13), in another environment all correct - I get current App\Domain\Admin. I get admin token and $headers['Authorization'], but method parseToken()->authenticate() wrong parse Entity only on testing environment.

How fix it?

Steps to reproduce

Create a few Entity and try to test it (with jwt-auth)

Expected behaviour

I should get App\Domain\Admin after parse token

Actual behaviour

I get App\Domain\User only on testing environment

bdemirpolat commented 5 years ago

Hi, you need set JWT_SECRET. You can use this command php artisan jwt:secret

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.