@devcoffee/nuxt-core 1.6.1 → 1.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.6.2
4
+
5
+ [compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.6.1...v1.6.2)
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - Preserve refresh token on token refresh ([bec49ab](https://github.com/coolkg1412/devcoffee-nuxt-core/commit/bec49ab))
10
+
11
+ ### ❤️ Contributors
12
+
13
+ - Hieu Nguyen <hieu.nguyen@devcoffee.tech>
14
+
3
15
  ## v1.6.1
4
16
 
5
17
  [compare changes](https://github.com/coolkg1412/devcoffee-nuxt-core/compare/v1.6.0...v1.6.1)
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-core",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "configKey": "nuxtCore",
5
5
  "compatibility": {
6
6
  "nuxt": "^4.0.0"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { addCustomTab } from '@nuxt/devtools-kit';
2
2
  import { defineNuxtModule, useLogger, createResolver, addTemplate, addServerImports, addServerImportsDir, addServerPlugin, addImportsDir, addPlugin, addRouteMiddleware, addServerHandler } from '@nuxt/kit';
3
3
  import { deepMerge, pick } from '../dist/runtime/utils.js';
4
4
 
5
- const version = "1.6.1";
5
+ const version = "1.6.2";
6
6
 
7
7
  const defaultLocale = "vi-VN";
8
8
  const defaultLanguage = "vi";
@@ -194,10 +194,11 @@ export declare function authorizationCodeGrant(authorizeParams: {
194
194
  * Ensures the token type is properly capitalized.
195
195
  *
196
196
  * @param input - The raw token endpoint response.
197
+ * @param fallbackRefreshToken - Existing refresh token to preserve when a refresh response omits rotation.
197
198
  * @returns A normalized token set containing access, id, and refresh tokens along with expiry.
198
199
  * @since 1.0.0
199
200
  */
200
- export declare function constructTokenSet(input: TokenEndpointResponse): {
201
+ export declare function constructTokenSet(input: TokenEndpointResponse, fallbackRefreshToken?: string): {
201
202
  tokenType: string;
202
203
  idToken: any;
203
204
  accessToken: any;
@@ -311,7 +311,7 @@ async function refreshTokenGrant(refreshToken, opts) {
311
311
  const config = await getOpenIdConfiguration(wellKnownUrl, discoveryOption);
312
312
  return refreshTokenGrantFromOidc(config, refreshToken);
313
313
  }
314
- export function constructTokenSet(input) {
314
+ export function constructTokenSet(input, fallbackRefreshToken) {
315
315
  let tokenType = input.token_type;
316
316
  if (tokenType.toUpperCase() === "BEARER") {
317
317
  tokenType = "Bearer";
@@ -320,7 +320,7 @@ export function constructTokenSet(input) {
320
320
  tokenType,
321
321
  idToken: input.id_token,
322
322
  accessToken: input.access_token,
323
- refreshToken: input.refresh_token,
323
+ refreshToken: input.refresh_token ?? fallbackRefreshToken,
324
324
  scopes: (input.scope || "").split(" "),
325
325
  expiresAt: Date.now() + (input.expires_in || 0) * 1e3
326
326
  };
@@ -405,7 +405,7 @@ export async function refreshTokenIfNeeded(session, opts) {
405
405
  sessionUpdate = {
406
406
  auth: {
407
407
  status: session.auth.status,
408
- tokenSet: constructTokenSet(tokenSet)
408
+ tokenSet: constructTokenSet(tokenSet, refreshToken)
409
409
  },
410
410
  user: session.user
411
411
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devcoffee/nuxt-core",
3
- "version": "1.6.1",
3
+ "version": "1.6.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },