@thinkingcat/auth-utils 2.0.11 → 2.0.13

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.
@@ -37,6 +37,7 @@ async function verifyAndRefreshToken(req, secret, options) {
37
37
  const refreshResult = await (0, api_1.refreshSSOToken)(refreshToken, {
38
38
  ssoBaseURL,
39
39
  authServiceKey,
40
+ serviceId,
40
41
  });
41
42
  if (refreshResult.success && refreshResult.accessToken) {
42
43
  const newRefreshToken = refreshResult.refreshToken || refreshToken;
@@ -118,7 +118,10 @@ async function handleJWTCallback(token, user, account, options) {
118
118
  'Content-Type': 'application/json',
119
119
  'x-auth-service-key': authServiceKey,
120
120
  },
121
- body: JSON.stringify({ refreshToken }),
121
+ body: JSON.stringify({
122
+ refreshToken,
123
+ serviceId: serviceId || undefined
124
+ }),
122
125
  });
123
126
  if (response.ok) {
124
127
  const result = await response.json();
package/dist/sso/api.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare function validateServiceSubscription(services: ServiceInfo[], ser
13
13
  export declare function refreshSSOToken(refreshToken: string, options: {
14
14
  ssoBaseURL: string;
15
15
  authServiceKey?: string;
16
+ serviceId?: string;
16
17
  }): Promise<SSORefreshTokenResponse>;
17
18
  /**
18
19
  * SSO 서버에서 사용자의 refresh token을 가져오는 함수
@@ -20,4 +21,5 @@ export declare function refreshSSOToken(refreshToken: string, options: {
20
21
  export declare function getRefreshTokenFromSSO(userId: string, accessToken: string, options: {
21
22
  ssoBaseURL: string;
22
23
  authServiceKey?: string;
24
+ serviceId?: string;
23
25
  }): Promise<string | null>;
package/dist/sso/api.js CHANGED
@@ -37,7 +37,7 @@ function validateServiceSubscription(services, serviceId, ssoBaseURL) {
37
37
  * SSO 서버에서 refresh token을 사용하여 새로운 access token을 발급받는 함수
38
38
  */
39
39
  async function refreshSSOToken(refreshToken, options) {
40
- const { ssoBaseURL, authServiceKey } = options;
40
+ const { ssoBaseURL, authServiceKey, serviceId } = options;
41
41
  if (!authServiceKey) {
42
42
  throw new Error('AUTH_SERVICE_SECRET_KEY not configured');
43
43
  }
@@ -47,7 +47,10 @@ async function refreshSSOToken(refreshToken, options) {
47
47
  'Content-Type': 'application/json',
48
48
  'x-auth-service-key': authServiceKey,
49
49
  },
50
- body: JSON.stringify({ refreshToken }),
50
+ body: JSON.stringify({
51
+ refreshToken,
52
+ serviceId
53
+ }),
51
54
  });
52
55
  return await refreshResponse.json();
53
56
  }
@@ -55,7 +58,7 @@ async function refreshSSOToken(refreshToken, options) {
55
58
  * SSO 서버에서 사용자의 refresh token을 가져오는 함수
56
59
  */
57
60
  async function getRefreshTokenFromSSO(userId, accessToken, options) {
58
- const { ssoBaseURL, authServiceKey } = options;
61
+ const { ssoBaseURL, authServiceKey, serviceId } = options;
59
62
  if (!authServiceKey) {
60
63
  return null;
61
64
  }
@@ -68,7 +71,8 @@ async function getRefreshTokenFromSSO(userId, accessToken, options) {
68
71
  },
69
72
  body: JSON.stringify({
70
73
  userId,
71
- accessToken
74
+ accessToken,
75
+ serviceId
72
76
  }),
73
77
  });
74
78
  const refreshResult = await refreshResponse.json();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingcat/auth-utils",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
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",