nuxt-auth-utils 0.0.19 → 0.0.21

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "auth-utils",
3
3
  "configKey": "auth",
4
- "version": "0.0.19"
4
+ "version": "0.0.21"
5
5
  }
package/dist/module.mjs CHANGED
@@ -62,8 +62,6 @@ const module = defineNuxtModule({
62
62
  if (!envContent.includes("NUXT_SESSION_PASSWORD")) {
63
63
  await writeFile(envPath, `${envContent ? envContent + "\n" : envContent}NUXT_SESSION_PASSWORD=${runtimeConfig.session.password}`, "utf-8");
64
64
  }
65
- } else if (!nuxt.options._prepare && !runtimeConfig.session.password) {
66
- throw new Error("NUXT_SESSION_PASSWORD environment variable or runtimeConfig.session.password not set");
67
65
  }
68
66
  runtimeConfig.oauth = defu(runtimeConfig.oauth, {});
69
67
  runtimeConfig.oauth.github = defu(runtimeConfig.oauth.github, {
@@ -27,6 +27,11 @@ export interface OAuthGoogleConfig {
27
27
  * @default 'https://oauth2.googleapis.com/token'
28
28
  */
29
29
  tokenURL?: string;
30
+ /**
31
+ * Google OAuth User URL
32
+ * @default 'https://www.googleapis.com/oauth2/v3/userinfo'
33
+ */
34
+ userURL?: string;
30
35
  /**
31
36
  * Extra authorization parameters to provide to the authorization URL
32
37
  * @see https://developers.google.com/identity/protocols/oauth2/web-server#httprest_3
@@ -18,6 +18,7 @@ export function googleEventHandler({
18
18
  config = defu(config, useRuntimeConfig(event).oauth?.google, {
19
19
  authorizationURL: "https://accounts.google.com/o/oauth2/v2/auth",
20
20
  tokenURL: "https://oauth2.googleapis.com/token",
21
+ userURL: "https://www.googleapis.com/oauth2/v3/userinfo",
21
22
  authorizationParams: {}
22
23
  });
23
24
  const { code } = getQuery(event);
@@ -69,7 +70,7 @@ export function googleEventHandler({
69
70
  }
70
71
  const accessToken = tokens.access_token;
71
72
  const user = await ofetch(
72
- "https://www.googleapis.com/oauth2/v3/userinfo",
73
+ config.userURL,
73
74
  {
74
75
  headers: {
75
76
  Authorization: `Bearer ${accessToken}`
@@ -33,7 +33,10 @@ export async function requireUserSession(event) {
33
33
  }
34
34
  return userSession;
35
35
  }
36
- const sessionConfig = useRuntimeConfig().session;
36
+ let sessionConfig;
37
37
  function _useSession(event) {
38
+ if (!sessionConfig) {
39
+ sessionConfig = defu({ password: process.env.NUXT_SESSION_PASSWORD }, useRuntimeConfig(event).session);
40
+ }
38
41
  return useSession(event, sessionConfig);
39
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-auth-utils",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Minimalist Auth module for Nuxt with SSR",
5
5
  "repository": "Atinux/nuxt-auth-utils",
6
6
  "license": "MIT",
@@ -30,29 +30,29 @@
30
30
  "test:watch": "vitest watch"
31
31
  },
32
32
  "dependencies": {
33
- "@nuxt/kit": "^3.10.2",
33
+ "@nuxt/kit": "^3.11.1",
34
34
  "defu": "^6.1.4",
35
35
  "hookable": "^5.5.3",
36
- "ofetch": "^1.3.3",
36
+ "ofetch": "^1.3.4",
37
37
  "ohash": "^1.1.3",
38
38
  "pathe": "^1.1.2",
39
39
  "uncrypto": "^0.1.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@iconify-json/simple-icons": "^1.1.91",
42
+ "@iconify-json/simple-icons": "^1.1.96",
43
43
  "@nuxt/devtools": "latest",
44
44
  "@nuxt/eslint-config": "^0.2.0",
45
45
  "@nuxt/module-builder": "^0.5.5",
46
- "@nuxt/schema": "^3.10.2",
47
- "@nuxt/test-utils": "^3.11.0",
48
- "@nuxt/ui": "^2.13.0",
49
- "@nuxt/ui-pro": "^0.7.5",
50
- "@types/node": "^20.11.19",
46
+ "@nuxt/schema": "^3.11.1",
47
+ "@nuxt/test-utils": "^3.12.0",
48
+ "@nuxt/ui": "^2.14.2",
49
+ "@nuxt/ui-pro": "^1.0.2",
50
+ "@types/node": "^20.11.30",
51
51
  "changelogen": "^0.5.5",
52
- "eslint": "^8.56.0",
53
- "nuxt": "^3.10.2",
54
- "typescript": "^5.3.3",
55
- "vitest": "^1.2.2",
56
- "vue-tsc": "^1.8.27"
52
+ "eslint": "^8.57.0",
53
+ "nuxt": "^3.11.1",
54
+ "typescript": "^5.4.3",
55
+ "vitest": "^1.4.0",
56
+ "vue-tsc": "^2.0.7"
57
57
  }
58
58
  }