@thinkingcat/auth-utils 1.0.23 → 1.0.24

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1256,20 +1256,25 @@ async function verifyAndRefreshTokenWithNextAuth(req, nextAuthToken, secret, opt
1256
1256
  hasValidAccess: hasValidAccessToken,
1257
1257
  hasRefresh: !!refreshToken,
1258
1258
  });
1259
- // NextAuth 토큰 또는 access token 하나라도 유효하면 통과
1260
- if (hasValidNextAuthToken || hasValidAccessToken) {
1261
- debugLog('verifyAndRefreshTokenWithNextAuth', 'At least one token is valid');
1259
+ // NextAuth cookie와 access token 모두 유효하면 통과
1260
+ if (hasValidNextAuthToken && hasValidAccessToken) {
1261
+ debugLog('verifyAndRefreshTokenWithNextAuth', 'Both NextAuth and access tokens are valid');
1262
1262
  return { isValid: true };
1263
1263
  }
1264
- // 없으면 refresh token으로 갱신 시도
1265
- if (refreshToken) {
1266
- debugLog('verifyAndRefreshTokenWithNextAuth', 'No valid tokens, attempting refresh');
1264
+ // NextAuth cookie가 없거나 access token 없으면 refresh 시도
1265
+ if (refreshToken && (!hasValidNextAuthToken || !hasValidAccessToken)) {
1266
+ debugLog('verifyAndRefreshTokenWithNextAuth', 'Missing NextAuth or access token, attempting refresh');
1267
1267
  const authCheck = await verifyAndRefreshToken(req, secret, {
1268
1268
  ...options,
1269
1269
  forceRefresh: true,
1270
1270
  });
1271
1271
  return authCheck;
1272
1272
  }
1273
+ // 하나라도 유효하면 일단 통과 (refresh token이 없는 경우)
1274
+ if (hasValidNextAuthToken || hasValidAccessToken) {
1275
+ debugLog('verifyAndRefreshTokenWithNextAuth', 'At least one token is valid (no refresh token)');
1276
+ return { isValid: true };
1277
+ }
1273
1278
  debugLog('verifyAndRefreshTokenWithNextAuth', 'No tokens available');
1274
1279
  return { isValid: false, error: 'NO_TOKEN' };
1275
1280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingcat/auth-utils",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "Authentication utilities for ThinkingCat SSO services with conditional logging",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",