Now with smooth access token refreshing

ref #6
This commit is contained in:
2020-12-18 19:07:31 +01:00
parent 65a8449ea3
commit 6403e386ab
4 changed files with 47 additions and 25 deletions

View File

@@ -7,8 +7,8 @@ export class JwtCreator {
public static createRefresh(user: User, expiry_timestamp?: number) {
if (!expiry_timestamp) { expiry_timestamp = Math.floor(Date.now() / 1000) + 10 * 36000; }
return jsonwebtoken.sign({
refreshtokencount: user.refreshTokenCount,
userid: user.id,
refreshTokenCount: user.refreshTokenCount,
id: user.id,
exp: expiry_timestamp
}, config.jwt_secret)
}
@@ -22,7 +22,7 @@ export class JwtCreator {
}
}
class JwtUser {
export class JwtUser {
@IsInt()
id: number;