nsarno / knock

Seamless JWT authentication for Rails API
MIT License
2.07k stars 253 forks source link

Two different token expiries in a single application #233

Closed 7ail closed 4 years ago

7ail commented 5 years ago

Hi,

I just wanted to know if this gem handles multiple different expiry times for tokens.

In my case, we have a web portal and apps. We want to have the jwt token to expire in 1hr for the web portal but have it expiry in 30 days for the app.

From what I can gather, it seems that the config file only supports either or but not both. Some help/insight will be much appreciated

Regards 7ail

vcavallo commented 5 years ago

hey @7ail did you ever end up figuring this out?

7ail commented 5 years ago

@vcavallo yes we did, however it felt rather hacky. We decided to extend the knock gem and override the jwt token generation function to cater for our use case.

We left the 1 hour as a default value through the config file and whenever the jwt is generated through the mobile controllers, we utilise the overwritten jwt token generation function instead

nsarno commented 4 years ago

Thank you. Closing this issue in favour of #241 which provide some extra details. Will consider supporting this in the future.