nebulab / simple_command

A simple, standardized way to build and use Service Objects (aka Commands) in Ruby

Home Page:http://nebulab.it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to modify default token expiration time

Nmuta opened this issue · comments

Hi, I'm using SimpleCommand in a Rails app with an Angular 7 front end. It all works beautifully and the auth is smooth and great.

I'm doing a very simple implementation similar to the one you have here in Github example.

My question is: how do I adjust the expiration date of the token ? It seems to default to 24 hours ( I think )

Let me know if you can, or point me in the right direction... thanks !

Disclaimer: not a member of the SimpleCommand team

SimpleCommand doesn't handle auth or token expiry itself, it's just a utility that provides a safe place to encapsulate that logic, which you are responsible for providing.

It sounds like you came here from a JWT tutorial like I did. You need to set the expiration date of the token when you create it, it's too late by the time you're using SimpleCommand.

Here's an example where a Token is created with an expiry time, from the offical ruby-jwt gem: https://github.com/jwt/ruby-jwt#expiration-time-claim