Skip to content

Commit 25b4d80

Browse files
committed
debug auth user
1 parent 81effa6 commit 25b4d80

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/routes/copilotOpportunity/get.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = [
3232
})
3333
.then((copilotOpportunity) => {
3434
const plainOpportunity = copilotOpportunity.get({ plain: true });
35+
req.log.info("authUser", req.authUser);
3536
const memberIds = plainOpportunity.project.members.map((member) => member.userId);
3637
// This shouldn't be exposed to the clientside
3738
delete plainOpportunity.project.members;

src/routes/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ const jwtAuth = require('tc-core-library-js').middleware.jwtAuthenticator;
3535
router.all(
3636
RegExp(`\\/${apiVersion}\\/(copilots|projects|timelines|orgConfig|customer-payments)(?!\\/health).*`),
3737
(req, res, next) => {
38-
if (publicRoutes.some(routeRegex => routeRegex.test(req.path))) {
38+
let token
39+
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
40+
token = req.headers.authorization.split(' ')[1]
41+
}
42+
if (publicRoutes.some(routeRegex => routeRegex.test(req.path)) && !token) {
3943
return next();
4044
}
45+
req.log.info("token available", token);
4146
// JWT authentication
4247
return jwtAuth(config)(req, res, next);
4348
},

0 commit comments

Comments
 (0)