@sbc-connect/nuxt-auth 0.12.0 → 0.13.0

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,11 @@
1
1
  # @sbc-connect/nuxt-auth
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#174](https://github.com/bcgov/connect-nuxt/pull/174) [`0f7a1d5`](https://github.com/bcgov/connect-nuxt/commit/0f7a1d56fedcd40d297780ca8847b8d253b512f6) Thanks [@deetz99](https://github.com/deetz99)! - Force token refresh after user is created in auth for new users (0 accounts) only.
8
+
3
9
  ## 0.12.0
4
10
 
5
11
  ### Minor Changes
@@ -4,15 +4,21 @@ export default defineNuxtPlugin({
4
4
  dependsOn: ['connect-auth', 'auth-api'],
5
5
  parallel: true,
6
6
  async setup(nuxtApp) {
7
- const { isAuthenticated } = useConnectAuth()
7
+ const { isAuthenticated, getToken } = useConnectAuth()
8
8
  const store = useConnectAccountStore()
9
9
 
10
10
  if (isAuthenticated.value) {
11
- // initialize user accounts and user profile on app mount
11
+ // Initialize user accounts and user profile on app mount
12
12
  await Promise.all([
13
13
  store.initAccountStore(),
14
14
  store.syncUserProfile()
15
15
  ])
16
+
17
+ // Force token refresh to return updated roles
18
+ // Required only for new users
19
+ if (store.userAccounts.length === 0) {
20
+ await getToken(true)
21
+ }
16
22
  }
17
23
 
18
24
  // sync user profile whenever the token is updated
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-auth",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.13.0",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",
@@ -12,8 +12,8 @@
12
12
  "typescript": "6.0.3",
13
13
  "vue-tsc": "3.3.1",
14
14
  "@sbc-connect/eslint-config": "0.0.8",
15
- "@sbc-connect/vitest-config": "0.2.0",
16
- "@sbc-connect/playwright-config": "0.2.0"
15
+ "@sbc-connect/playwright-config": "0.2.0",
16
+ "@sbc-connect/vitest-config": "0.2.0"
17
17
  },
18
18
  "dependencies": {
19
19
  "@pinia/colada": "1.3.0",
@@ -22,8 +22,8 @@
22
22
  "keycloak-js": "26.2.4",
23
23
  "pinia": "3.0.4",
24
24
  "pinia-plugin-persistedstate": "4.7.1",
25
- "@sbc-connect/nuxt-base": "0.10.0",
26
- "@sbc-connect/nuxt-forms": "0.7.5"
25
+ "@sbc-connect/nuxt-forms": "0.7.5",
26
+ "@sbc-connect/nuxt-base": "0.10.0"
27
27
  },
28
28
  "scripts": {
29
29
  "preinstall": "npx only-allow pnpm",