From ef9d9382dafd8f16515282fa664d771da9a75bf5 Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Mon, 2 Dec 2024 13:39:37 -0800 Subject: [PATCH] chore(server): Add telemetry for failed ORCID auth --- packages/openneuro-server/src/libs/authentication/orcid.ts | 2 ++ packages/openneuro-server/src/libs/orcid.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/openneuro-server/src/libs/authentication/orcid.ts b/packages/openneuro-server/src/libs/authentication/orcid.ts index f71f2aab2..ae91a914c 100644 --- a/packages/openneuro-server/src/libs/authentication/orcid.ts +++ b/packages/openneuro-server/src/libs/authentication/orcid.ts @@ -1,6 +1,7 @@ import passport from "passport" import User from "../../models/user" import { parsedJwtFromRequest } from "./jwt" +import * as Sentry from "@sentry/node" export const requestAuth = passport.authenticate("orcid", { session: false, @@ -9,6 +10,7 @@ export const requestAuth = passport.authenticate("orcid", { export const authCallback = (req, res, next) => passport.authenticate("orcid", (err, user) => { if (err) { + Sentry.captureException(err) if (err.type) { return res.redirect(`/error/orcid/${err.type}`) } else { diff --git a/packages/openneuro-server/src/libs/orcid.ts b/packages/openneuro-server/src/libs/orcid.ts index 3e311058a..dffbbca29 100644 --- a/packages/openneuro-server/src/libs/orcid.ts +++ b/packages/openneuro-server/src/libs/orcid.ts @@ -2,6 +2,7 @@ import request from "request" import xmldoc from "xmldoc" import config from "../config" +import * as Sentry from "@sentry/node" export default { getProfile(token) { @@ -20,6 +21,7 @@ export default { }, (err, res) => { if (err) { + Sentry.captureException(err) reject({ message: "An unexpected ORCID login failure occurred, please try again later.",