[GH-ISSUE #3344] [bug]: MagicLink does not work #1115

Closed
opened 2026-03-16 18:39:16 +03:00 by kerem · 1 comment
Owner

Originally created by @cventastic on GitHub (Sep 12, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3344

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When I request an e-mail with a magic link and i click on it, the webinterface (hoppscotch-app container) shows the following:
Request failed with status code 500
the same is happening when i try to use the admin-dashboard to get a magic link.
Expected behavior is to be logged in after using the magic link.

Using release 2023.08.0.
self-hosted community edition.
with 4 seperate containers (frontend, backend, admin-dashboard, database)

Steps to reproduce

  1. Using the hoppscotch-app containers webapp. Go to Login.
  2. Click "Continue with EMail"
  3. Send e-mail
  4. Click on link inside received e-mail.
  5. See error. image
  6. See error in logs of backend container:
hoppscotch-backend     | [Nest] 19  - 09/12/2023, 7:32:56 AM   ERROR [ExceptionsHandler] "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
hoppscotch-backend     | Error: "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
hoppscotch-backend     |     at module.exports [as sign] (/usr/src/app/node_modules/.pnpm/jsonwebtoken@9.0.0/node_modules/jsonwebtoken/sign.js:207:22)
hoppscotch-backend     |     at JwtService.sign (/usr/src/app/node_modules/.pnpm/@nestjs+jwt@10.0.1_@nestjs+common@9.2.1/node_modules/@nestjs/jwt/dist/jwt.service.js:28:20)
hoppscotch-backend     |     at AuthService.generateRefreshToken (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:70:52)
hoppscotch-backend     |     at AuthService.generateAuthTokens (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:88:41)
hoppscotch-backend     |     at AuthService.verifyMagicLinkTokens (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:191:35)
hoppscotch-backend     |     at async AuthController.verify (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:45:28)
hoppscotch-backend     |     at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
hoppscotch-backend     |     at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17

additional information:

in the database i can see (redacted my device identifier):

deviceIdentifier | token | userUid | expiresOn
-------------------------------+---------------------------+---------------------------+-------------------------
$mydeviceidentifierhash| clmfzwrfa0007l70jiueconix | clmesvi2h0000oi0kzs87is1y | 2023-09-12 10:32:45.141

the magic link looks like:

https://my.domain.tld/enter?token=clmfzwrfa0007l70jiueconix

Environment

Release

Version

Self-hosted

Originally created by @cventastic on GitHub (Sep 12, 2023). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3344 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior When I request an e-mail with a magic link and i click on it, the webinterface (hoppscotch-app container) shows the following: ```Request failed with status code 500``` the same is happening when i try to use the admin-dashboard to get a magic link. Expected behavior is to be logged in after using the magic link. Using release 2023.08.0. self-hosted community edition. with 4 seperate containers (frontend, backend, admin-dashboard, database) ### Steps to reproduce 1. Using the hoppscotch-app containers webapp. Go to Login. 2. Click "Continue with EMail" 3. Send e-mail 4. Click on link inside received e-mail. 6. See error. ![image](https://github.com/hoppscotch/hoppscotch/assets/13015146/bd66a499-b347-4cc5-a0bc-df2e194b7226) 7. See error in logs of backend container: ``` hoppscotch-backend | [Nest] 19 - 09/12/2023, 7:32:56 AM ERROR [ExceptionsHandler] "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60 hoppscotch-backend | Error: "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60 hoppscotch-backend | at module.exports [as sign] (/usr/src/app/node_modules/.pnpm/jsonwebtoken@9.0.0/node_modules/jsonwebtoken/sign.js:207:22) hoppscotch-backend | at JwtService.sign (/usr/src/app/node_modules/.pnpm/@nestjs+jwt@10.0.1_@nestjs+common@9.2.1/node_modules/@nestjs/jwt/dist/jwt.service.js:28:20) hoppscotch-backend | at AuthService.generateRefreshToken (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:70:52) hoppscotch-backend | at AuthService.generateAuthTokens (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:88:41) hoppscotch-backend | at AuthService.verifyMagicLinkTokens (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:191:35) hoppscotch-backend | at async AuthController.verify (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:45:28) hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28 hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17 ``` additional information: in the database i can see (redacted my device identifier): ``` deviceIdentifier | token | userUid | expiresOn -------------------------------+---------------------------+---------------------------+------------------------- $mydeviceidentifierhash| clmfzwrfa0007l70jiueconix | clmesvi2h0000oi0kzs87is1y | 2023-09-12 10:32:45.141 ``` the magic link looks like: ``` https://my.domain.tld/enter?token=clmfzwrfa0007l70jiueconix ``` ### Environment Release ### Version Self-hosted
kerem 2026-03-16 18:39:16 +03:00
Author
Owner

@cventastic commented on GitHub (Sep 12, 2023):

the problem was in front of the screen.
i copied the .env.example but didnt ensure all comments and quotes were deleted:

https://github.com/hoppscotch/hoppscotch/blob/release/2023.8.0/.env.example#L9-L10

Defining the following environment variables as documented in the docs, solved the issue.

MAGIC_LINK_TOKEN_VALIDITY=3
REFRESH_TOKEN_VALIDITY=604800000
ACCESS_TOKEN_VALIDITY=86400000
<!-- gh-comment-id:1715583120 --> @cventastic commented on GitHub (Sep 12, 2023): the problem was in front of the screen. i copied the .env.example but didnt ensure all comments and quotes were deleted: https://github.com/hoppscotch/hoppscotch/blob/release/2023.8.0/.env.example#L9-L10 Defining the following environment variables as documented in the docs, solved the issue. ``` MAGIC_LINK_TOKEN_VALIDITY=3 REFRESH_TOKEN_VALIDITY=604800000 ACCESS_TOKEN_VALIDITY=86400000 ```
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#1115
No description provided.