@riocrypto/common-server 1.0.683 → 1.0.685

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
66
66
  }
67
67
  else if ((_a = req.cookies) === null || _a === void 0 ? void 0 : _a.accessToken) {
68
68
  try {
69
+ console.log("Getting access token");
69
70
  const ACCESS_TOKEN_SECRET = yield secret_manager_client_1.secretManagerClient.getSecretValue("ACCESS_TOKEN_SECRET");
70
71
  if (!ACCESS_TOKEN_SECRET) {
71
72
  throw new Error("Unable to get ACCESS_TOKEN_SECRET");
@@ -73,7 +74,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
73
74
  const payload = jsonwebtoken_1.default.verify(req.cookies.accessToken, ACCESS_TOKEN_SECRET);
74
75
  req.currentAuth = payload;
75
76
  }
76
- catch (err) { }
77
+ catch (err) {
78
+ console.log(err);
79
+ }
77
80
  }
78
81
  if (!authorizationTypes.includes(common_1.AuthorizationType.UserOptional)) {
79
82
  if ((_c = (_b = req.currentAuth) === null || _b === void 0 ? void 0 : _b.missing) === null || _c === void 0 ? void 0 : _c.includes("password")) {
@@ -139,13 +142,16 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
139
142
  }
140
143
  if (authorizationTypes.includes(common_1.AuthorizationType.User) ||
141
144
  authorizationTypes.includes(common_1.AuthorizationType.UserOptional)) {
145
+ console.log("Getting user 1");
142
146
  let user;
143
147
  try {
148
+ console.log("Getting user");
144
149
  const User = yield (0, user_1.buildUser)(mongoose);
145
150
  user = yield User.findOne({
146
151
  authIds: { $in: [req.currentAuth.id] },
147
152
  attributes: { $ne: common_1.UserAttribute.deleted },
148
153
  });
154
+ console.log("user", user);
149
155
  if (!user) {
150
156
  throw new Error();
151
157
  }
@@ -161,6 +167,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
161
167
  user = null;
162
168
  }
163
169
  if (user) {
170
+ console.log("setting user");
164
171
  req.user = user;
165
172
  }
166
173
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.683",
3
+ "version": "1.0.685",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",