Skip to content

Commit

Permalink
feat: improve error reporting for invalid magic links
Browse files Browse the repository at this point in the history
  • Loading branch information
aashir-motorway committed Nov 7, 2024
1 parent 21f72ff commit a164c2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/magic-link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function checkCurrentLocationForSignInLink() {
debug?.("Magic link header parsed:", message);
assertIsMessage(message);
} catch (err) {
debug?.("Ignoring invalid fragment identifier");
debug?.("Ignoring invalid fragment identifier", { err });
return;
}
if (!message.userName || typeof message.userName !== "string") {
Expand Down Expand Up @@ -168,7 +168,7 @@ function assertIsMessage(
!("iat" in msg) ||
typeof msg.iat !== "number"
) {
throw new Error("Invalid magic link");
throw new Error(`Invalid magic link, expecting exp, iat, and userName to be present. Received: ${JSON.stringify(msg)}`);
}
}

Expand Down

0 comments on commit a164c2e

Please sign in to comment.