@rentbase/common 1.0.8 → 1.0.9

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.
@@ -22,10 +22,17 @@ const requireAuth = (req, res, next) => {
22
22
  : (_a = req.cookies) === null || _a === void 0 ? void 0 : _a.accessToken;
23
23
  // Check if token exists
24
24
  if (!token) {
25
+ console.log("[requireAuth] No token provided");
25
26
  throw new not_authorized_error_1.NotAuthorizedError();
26
27
  }
27
28
  // Verify token
28
29
  const payload = jsonwebtoken_1.default.verify(token, JWT_SECRET);
30
+ console.log("[requireAuth] Token verified successfully:", {
31
+ userId: payload.userId,
32
+ id: payload.id,
33
+ email: payload.email,
34
+ hasAccountNumber: !!payload.accountNumber
35
+ });
29
36
  // Attach user payload to request
30
37
  req.currentUser = payload;
31
38
  // Support both legacy 'id' and new 'userId' formats
@@ -34,6 +41,7 @@ const requireAuth = (req, res, next) => {
34
41
  next();
35
42
  }
36
43
  catch (err) {
44
+ console.error("[requireAuth] Error:", err.message, err.name);
37
45
  if (err.name === "TokenExpiredError") {
38
46
  return res.status(401).json({
39
47
  error: "TOKEN_EXPIRED",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rentbase/common",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "common library for rentbase",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",