[GH-ISSUE #3577] Magic Link Toen expired immediately with non-default timezone #1226

Closed
opened 2026-03-16 19:23:38 +03:00 by kerem · 7 comments
Owner

Originally created by @WestFarmer on GitHub (Nov 22, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3577

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

login with email, the token is expired immediately.

Steps to reproduce

I am deploying with kubernetes and mounted a timezone file like this:

volumeMounts:     
- name: tz
  mountPath: /etc/localtime
volumes:
- name: tz
  hostPath:
  path: /usr/share/zoneinfo/Asia/Shanghai

I am doing this is because I am in UTC+8, to see correct time such as in logs.

but this will fail the email magic link login

Environment

Production

Version

Self-hosted

Originally created by @WestFarmer on GitHub (Nov 22, 2023). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3577 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior login with email, the token is expired immediately. ### Steps to reproduce I am deploying with kubernetes and mounted a timezone file like this: ``` volumeMounts: - name: tz mountPath: /etc/localtime volumes: - name: tz hostPath: path: /usr/share/zoneinfo/Asia/Shanghai ``` I am doing this is because I am in UTC+8, to see correct time such as in logs. but this will fail the email magic link login ### Environment Production ### Version Self-hosted
kerem 2026-03-16 19:23:38 +03:00
Author
Owner

@dudename commented on GitHub (Nov 29, 2023):

Had the same issue. In my case, I have mounted /etc/localtime in containers and authorization via magic link in an email  return a 401 code and a message that the magic link has expired.

<!-- gh-comment-id:1832569956 --> @dudename commented on GitHub (Nov 29, 2023): Had the same issue. In my case, I have mounted /etc/localtime in containers and authorization via magic link in an email  return a 401 code and a message that the magic link has expired.
Author
Owner

@kadet77rus commented on GitHub (Dec 4, 2023):

Had the same issue. But i didn't mount localtime file

<!-- gh-comment-id:1838683396 --> @kadet77rus commented on GitHub (Dec 4, 2023): Had the same issue. But i didn't mount localtime file
Author
Owner

@kadet77rus commented on GitHub (Dec 4, 2023):

For clarify - i have the same timezone on all my VMs and containers, but i see user creation time at UTC. I've added to AIO container tzdata package

hoppscotch container:

docker exec -it hoppscotch /bin/sh
/usr/src/app/packages/hoppscotch-backend # date
Mon Dec  4 17:48:55 MSK 2023

host with DB:

root@patroni14-1.node.dev.consul [~]: date
Mon 04 Dec 2023 05:49:07 PM MSK
hoppscotchdb=#hoppscotchdb=# select * from "User";
-[ RECORD 1 ]------+----------------------------
uid                | clpr12llh0000r428bxl0eoj4
displayName        | 
email              | ilya.tikhonov@1520signal.ru
photoURL           | 
isAdmin            | f
refreshToken       | 
currentRESTSession | 
currentGQLSession  | 
createdOn          | 2023-12-04 14:49:52.085
hoppscotchdb=# select * from "VerificationToken" ;
-[ RECORD 1 ]----+------------------------------
deviceIdentifier | $2b$10$LOXhFR0xG4jiGDhez4QkGO
token            | clpr12lnv0003r428ple671fc
userUid          | clpr12llh0000r428bxl0eoj4
expiresOn        | 2023-12-04 17:49:52.146
<!-- gh-comment-id:1838810412 --> @kadet77rus commented on GitHub (Dec 4, 2023): For clarify - i have the same timezone on all my VMs and containers, but i see user creation time at UTC. I've added to AIO container tzdata package hoppscotch container: ```bash docker exec -it hoppscotch /bin/sh /usr/src/app/packages/hoppscotch-backend # date Mon Dec 4 17:48:55 MSK 2023 ``` host with DB: ```bash root@patroni14-1.node.dev.consul [~]: date Mon 04 Dec 2023 05:49:07 PM MSK ``` ```bash hoppscotchdb=#hoppscotchdb=# select * from "User"; -[ RECORD 1 ]------+---------------------------- uid | clpr12llh0000r428bxl0eoj4 displayName | email | ilya.tikhonov@1520signal.ru photoURL | isAdmin | f refreshToken | currentRESTSession | currentGQLSession | createdOn | 2023-12-04 14:49:52.085 ``` ```bash hoppscotchdb=# select * from "VerificationToken" ; -[ RECORD 1 ]----+------------------------------ deviceIdentifier | $2b$10$LOXhFR0xG4jiGDhez4QkGO token | clpr12lnv0003r428ple671fc userUid | clpr12llh0000r428bxl0eoj4 expiresOn | 2023-12-04 17:49:52.146 ```
Author
Owner

@kadet77rus commented on GitHub (Dec 5, 2023):

maybe, this check works incorrectly?

if (currentTime > passwordlessTokens.value.expiresOn.toISOString())

workaround: increase value of MAGIC_LINK_TOKEN_VALIDITY in the .env file

<!-- gh-comment-id:1840127908 --> @kadet77rus commented on GitHub (Dec 5, 2023): maybe, this check works incorrectly? ```ts if (currentTime > passwordlessTokens.value.expiresOn.toISOString()) ``` workaround: increase value of `MAGIC_LINK_TOKEN_VALIDITY` in the `.env` file
Author
Owner

@zonewancheng commented on GitHub (Sep 29, 2024):

I also encountered this problem, and I solved it in the following way

image
<!-- gh-comment-id:2381270423 --> @zonewancheng commented on GitHub (Sep 29, 2024): I also encountered this problem, and I solved it in the following way <img width="1121" alt="image" src="https://github.com/user-attachments/assets/78fe3478-4de8-4aa9-9b5b-4f66765a4e0d">
Author
Owner

@lht030825 commented on GitHub (Apr 21, 2025):

I've run into this issue too. Since the analysis above has identified the problem, could we implement a fix?

<!-- gh-comment-id:2817570375 --> @lht030825 commented on GitHub (Apr 21, 2025): I've run into this issue too. Since the analysis above has identified the problem, could we implement a fix?
Author
Owner

@liyasthomas commented on GitHub (Jul 30, 2025):

This issue has been resolved in the latest version.

<!-- gh-comment-id:3136225245 --> @liyasthomas commented on GitHub (Jul 30, 2025): This issue has been resolved in the latest version.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1226
No description provided.