cobras-auth-nuxt 1.0.5 → 1.0.7

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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "1.0.4",
7
+ "version": "1.0.7",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "unknown"
@@ -3,7 +3,8 @@ export default defineNuxtRouteMiddleware(async (to) => {
3
3
  const config = useRuntimeConfig();
4
4
  const authConfig = config.public.cobrasAuth;
5
5
  const state = useState("cobras-auth-state");
6
- if (to.query.code) {
6
+ const hasCode = to.query.code || typeof window === "undefined" && useRequestURL().searchParams.has("code");
7
+ if (hasCode) {
7
8
  return;
8
9
  }
9
10
  if (authConfig.mode === "public") {
@@ -3,7 +3,8 @@ export default defineNuxtRouteMiddleware(async (to) => {
3
3
  const config = useRuntimeConfig();
4
4
  const authConfig = config.public.cobrasAuth;
5
5
  const state = useState("cobras-auth-state");
6
- if (to.query.code) {
6
+ const hasCode = to.query.code || typeof window === "undefined" && useRequestURL().searchParams.has("code");
7
+ if (hasCode) {
7
8
  return;
8
9
  }
9
10
  if (!state.value?.initialized) {
@@ -19,7 +19,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
19
19
  try {
20
20
  const headers = useRequestHeaders(["cookie"]);
21
21
  const response = await $fetch(
22
- `${authConfig.authServiceUrl}/api/auth/verify`,
22
+ "/api/_cobras/verify",
23
23
  {
24
24
  headers: {
25
25
  cookie: headers.cookie || ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cobras-auth-nuxt",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Nuxt 3/4 module for Cobras Auth service - supports internal (SSO) and public modes",
5
5
  "repository": {
6
6
  "type": "git",