Skip to content

Commit

Permalink
chore(jwt): removed timestamps from JWT
Browse files Browse the repository at this point in the history
  • Loading branch information
ful1e5 committed Nov 21, 2023
1 parent fb67632 commit d01d491
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/utils/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def log_error(e):
logger.error(e) if logger else None

try:
payload = jwt.decode(token, SECRET, algorithms=["HS256"], leeway=10)
payload = jwt.decode(token, SECRET, algorithms=["HS256"])
auth = as_token(payload)
if auth:
return auth
Expand Down
8 changes: 4 additions & 4 deletions src/utils/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { JWTToken } from 'bibata/misc';
const SECRET_KEY = process.env.NEXT_PUBLIC_JWT_SECRET;
export const genAccessToken = (user?: User) => {
const token_id = v4();
const iat = Math.floor(Date.now() / 1000);
let payload = { iat, token_id, role: 'ANONYMOUS' };
if (user) payload = { iat, token_id, ...user };
let payload = { token_id, role: 'ANONYMOUS' };
if (user) payload = { token_id, ...user };

const token = jwt.sign(payload, process.env.NEXT_PUBLIC_JWT_SECRET, {
algorithm: 'HS256'
algorithm: 'HS256',
noTimestamp: true
});

return {
Expand Down

0 comments on commit d01d491

Please sign in to comment.