codecasts / laravel-jwt

Dead simple, plug and play JWT API Authentication for Laravel (5.4+)
MIT License
234 stars 27 forks source link

Allow to change secret key before or after Manager initialization #26

Closed jonagoldman closed 6 years ago

jonagoldman commented 6 years ago

I want to have multiple secret keys for better security (related to https://github.com/codecasts/laravel-jwt/issues/25). In my application each tenant have a secret key saved in the database, so I need a way to change the key set in Codecasts\Auth\JWT\Token\Manager.

I tried to change the config inside a middleware:

Config::set('jwt.secret', $tenant->jwt_secret);

but the Manager is initialized before the middleware runs, so the change is irrelevant.

I need a way to change the key in the config before the Manager is initialized or a way to change the key afterwards.

jonagoldman commented 6 years ago

Fixed in https://github.com/codecasts/laravel-jwt/pull/27