diff --git a/packages/nc-gui/middleware/auth.global.ts b/packages/nc-gui/middleware/auth.global.ts index c128999bbf..4253c4bf34 100644 --- a/packages/nc-gui/middleware/auth.global.ts +++ b/packages/nc-gui/middleware/auth.global.ts @@ -1,6 +1,7 @@ import type { Api } from 'nocodb-sdk' import type { Actions } from '~/composables/useGlobal/types' import { defineNuxtRouteMiddleware, message, navigateTo, useApi, useGlobal, useRoles } from '#imports' +import { extractSdkResponseErrorMsg } from '~/utils' /** * Global auth middleware @@ -46,7 +47,9 @@ export default defineNuxtRouteMiddleware(async (to, from) => { } /** if user isn't signed in and google auth is enabled, try to check if sign-in data is present */ - if (!state.signedIn.value && state.appInfo.value.googleAuthEnabled) await tryGoogleAuth(api, state.signIn) + if (!state.signedIn.value && state.appInfo.value.googleAuthEnabled) { + await tryGoogleAuth(api, state.signIn) + } /** if public allow all visitors */ if (to.meta.public) return @@ -115,7 +118,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => { * If present, try using google auth data to sign user in before navigating to the next page */ async function tryGoogleAuth(api: Api, signIn: Actions['signIn']) { - /* if (window.location.search && /\bscope=|\bstate=/.test(window.location.search) && /\bcode=/.test(window.location.search)) { + if (window.location.search && /\bscope=|\bstate=/.test(window.location.search) && /\bcode=/.test(window.location.search)) { let extraProps: any = {} try { let authProvider = 'google' @@ -143,5 +146,5 @@ async function tryGoogleAuth(api: Api, signIn: Actions['signIn']) { `${extraProps.continueAfterSignIn ? `${newURL}#/?continueAfterSignIn=${extraProps.continueAfterSignIn}` : newURL}`, ) window.location.reload() - } */ + } }