Skip to content

Commit

Permalink
chore(server): Add telemetry for failed ORCID auth
Browse files Browse the repository at this point in the history
  • Loading branch information
nellh committed Dec 2, 2024
1 parent 9063c9a commit ef9d938
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/openneuro-server/src/libs/authentication/orcid.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions packages/openneuro-server/src/libs/orcid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.",
Expand Down

0 comments on commit ef9d938

Please sign in to comment.