vdomah / oc-jwtauth

JWTAuth plugin for October CMS wich provides token based authentication
MIT License
27 stars 21 forks source link

Auth crashing because of different declarations of $rememberTokenName #18

Closed kosmonowt closed 4 years ago

kosmonowt commented 5 years ago

Actually, I don't know if this is the right place to post this error (I'll put it to the october core repo as well).

Anyhow, trying to do the authentication with the current OctoberCMS version through JWT will result into the following error:

[Fri May 17 16:51:35.315766 2019] [fcgid:warn] [pid 18049] [client 24.134.39.209:60808] mod_fcgid: stderr: PHP Fatal error: October\\Rain\\Auth\\Models\\User and Illuminate\\Auth\\Authenticatable define the same property ($rememberTokenName) in the composition of Vdomah\\JWTAuth\\Models\\User. However, the definition differs and is considered incompatible. Class was composed in /var/www/vhosts/test/htdocs/test/plugins/vdomah/jwtauth/models/User.php on line 5

What I found out was that the concurrent declarations will be found here, in the vendor directory of the OctoberCMS root folder:

vendor/october/rain/src/Auth/Models/User.php: protected $rememberTokenName = 'persist_code'; vendor/october/rain/src/Auth/Models/User.php: return $this->rememberTokenName; vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php: protected $rememberTokenName = 'remember_token'; vendor/laravel/framework/src/Illuminate/Auth/Authenticatable.php: return $this->rememberTokenName;

After changing it to "persist_code" there is no problem with authenticating anymore.

Does anyone else have that problem as well here? Or found a solution without modifying the vendor files?

kosmonowt commented 5 years ago

Will be fixed with pull request #17

vdomah commented 4 years ago

fixed, thanks for pr! https://github.com/vdomah/oc-jwtauth/commit/17c8b0dca7b7dcba3a6dac0f3e9411cd9c305b05