Reputation: 15
I am studying the examples that the framework offers
In the To-Do example, it has JWT authentication.
How long does the generated token expire?
I didn't see a second or similar parameter, which could help with this
Link: https://github.com/strongloop/loopback-next/tree/master/examples/todo-jwt
OR
lb4 example todo-jwt
Upvotes: 0
Views: 962
Reputation: 1585
@loopback/todo-jwt example leverages @loopback/authentication-jwt, which provides configurable defaults.
By default, tokens expire in 21600s (git permalink), and refresh tokens expire in 216000s (git permalink)
Both of these are configurable (git permalink):
// Inside RestApplication constructor
// for jwt access token expiration
this.bind(TokenServiceBindings.TOKEN_EXPIRES_IN).to("<Expiration Time in sec>");
// for refresh token expiration
this.bind(RefreshTokenServiceBindings.TOKEN_EXPIRES_IN).to("<Expiration Time in sec>");
Upvotes: 4