MCPcopy Create free account
hub / github.com/CFBD/cfb-api / originAuth

Function originAuth

config/express.js:71–90  ·  view source on GitHub ↗
(req, res, next)

Source from the content-addressed store, hash-verified

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) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected