@ahhaohho/auth-middleware 2.3.1 → 2.3.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahhaohho/auth-middleware",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Shared authentication and authorization middleware for ahhaohho microservices",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -38,7 +38,7 @@ function authenticateJWT(req, res, next) {
38
38
  if (err || !user) {
39
39
  return res.status(401).json({
40
40
  error: 'Unauthorized',
41
- message: err?.message || info?.message || 'Invalid or expired token'
41
+ message: info?.message || 'Invalid or expired token'
42
42
  });
43
43
  }
44
44
 
@@ -69,7 +69,7 @@ function authenticateRefresh(req, res, next) {
69
69
  if (err || !user) {
70
70
  return res.status(401).json({
71
71
  error: 'Invalid refresh token',
72
- message: err?.message || info?.message || 'Invalid or expired refresh token'
72
+ message: info?.message || 'Invalid or expired refresh token'
73
73
  });
74
74
  }
75
75
 
@@ -163,7 +163,7 @@ async function authenticateHybrid(req, res, next) {
163
163
  if (refreshErr || !refreshUser) {
164
164
  return res.status(401).json({
165
165
  error: 'Unauthorized',
166
- message: refreshErr?.message || 'Both access and refresh tokens are invalid'
166
+ message: 'Both access and refresh tokens are invalid'
167
167
  });
168
168
  }
169
169
 
@@ -196,7 +196,7 @@ async function authenticateHybrid(req, res, next) {
196
196
  console.error('[@ahhaohho/auth-middleware] Failed to generate new token:', tokenError.message);
197
197
  return res.status(500).json({
198
198
  error: 'Token generation error',
199
- message: tokenError.message
199
+ message: 'Failed to generate new access token'
200
200
  });
201
201
  }
202
202
  })(req, res, next);