@thinkingcat/auth-utils 1.0.32 → 1.0.33

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 +5 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -654,33 +654,12 @@ async function verifyAndRefreshToken(req, secret, options) {
654
654
  catch {
655
655
  // 토큰 검증 실패
656
656
  }
657
- debugLog('verifyAndRefreshToken', 'Updating cookies without redirect...');
658
- // NextResponse.next()를 생성하고 쿠키만 설정
657
+ debugLog('verifyAndRefreshToken', 'Updating custom cookies only (NextAuth will handle session)...');
658
+ // NextResponse.next()를 생성하고 커스텀 토큰만 설정
659
+ // NextAuth 쿠키는 생성하지 않음 - NextAuth가 자체적으로 처리하도록 함
659
660
  const { NextResponse: NextResponseClass } = await getNextServer();
660
661
  const response = NextResponseClass.next();
661
- // NextAuth JWT 생성
662
- const jwt = createNextAuthJWT(payload, serviceId);
663
- if (newRefreshToken) {
664
- jwt.refreshToken = newRefreshToken;
665
- }
666
- jwt.accessTokenExpires = Date.now() + (15 * 60 * 1000);
667
- // NextAuth 세션 쿠키 설정
668
- const nextAuthToken = await encodeNextAuthToken(jwt, secret);
669
- const nextAuthCookieName = isProduction
670
- ? '__Secure-next-auth.session-token'
671
- : 'next-auth.session-token';
672
- const cookieOptions = {
673
- httpOnly: true,
674
- secure: isProduction,
675
- sameSite: isProduction ? 'none' : 'lax',
676
- path: '/',
677
- maxAge: 30 * 24 * 60 * 60,
678
- };
679
- if (cookieDomain) {
680
- cookieOptions.domain = cookieDomain;
681
- }
682
- response.cookies.set(nextAuthCookieName, nextAuthToken, cookieOptions);
683
- // 커스텀 토큰 쿠키 설정
662
+ // 커스텀 토큰 쿠키만 설정
684
663
  if (newRefreshToken) {
685
664
  setCustomTokens(response, refreshResult.accessToken, newRefreshToken, {
686
665
  cookiePrefix,
@@ -695,7 +674,7 @@ async function verifyAndRefreshToken(req, secret, options) {
695
674
  cookieDomain,
696
675
  });
697
676
  }
698
- debugLog('verifyAndRefreshToken', 'Cookies updated, continuing with current request');
677
+ debugLog('verifyAndRefreshToken', 'Custom cookies updated, NextAuth will pick them up via handleJWTCallback');
699
678
  return { isValid: true, response, payload };
700
679
  }
701
680
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingcat/auth-utils",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
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",