(req, res, next)
| 69 | const apm = apmConfig(dbInfo.authDb); |
| 70 | |
| 71 | const originAuth = (req, res, next) => { |
| 72 | passport.authenticate("bearer", (err, user, info) => { |
| 73 | if (user && user.blacklisted == true) { |
| 74 | res.status(401).send("Account has been blacklisted."); |
| 75 | } else if ( |
| 76 | user || |
| 77 | (req.get("origin") == corsOrigin || req.get("host") == corsOrigin) || |
| 78 | env == "development" |
| 79 | ) { |
| 80 | req.user = user; |
| 81 | next(); |
| 82 | } else { |
| 83 | res |
| 84 | .status(401) |
| 85 | .send( |
| 86 | 'Unauthorized. Did you forget to add "Bearer " before your key? Go to CollegeFootballData.com to register for your free API key. See the CFBD Blog for examples on usage: https://blog.collegefootballdata.com/using-api-keys-with-the-cfbd-api.' |
| 87 | ); |
| 88 | } |
| 89 | })(req, res, next); |
| 90 | }; |
| 91 | |
| 92 | const patreonAuth = (req, res, next) => { |
| 93 | passport.authenticate("bearer", (err, user, info) => { |
nothing calls this directly
no outgoing calls
no test coverage detected