@@ -68,9 +68,10 @@ export default defineNuxtModule<RuntimeModuleOptions>({
6868 ...runtimeConfigOptions . auth ,
6969 whitelist : ( ( ) => {
7070 const combinedWhitelist = [ ...( defaultOptions . auth ?. whitelist || [ ] ) , ...( runtimeConfigOptions . auth ?. whitelist || [ ] ) ]
71+ const apiBasePath = runtimeConfigOptions . apiBasePath || defaultOptions . apiBasePath
72+
7173 // Auto-whitelist related endpoints if /register is whitelisted
7274 if ( combinedWhitelist . includes ( '/register' ) ) {
73- const apiBasePath = runtimeConfigOptions . apiBasePath || defaultOptions . apiBasePath
7475 const registrationEndpoints = [
7576 '/confirm-email' , // Page route for email confirmation
7677 `${ apiBasePath } /register` , // API endpoint for registration
@@ -83,8 +84,23 @@ export default defineNuxtModule<RuntimeModuleOptions>({
8384 }
8485 } )
8586 }
87+
88+ // Auto-whitelist Google OAuth endpoints if Google OAuth is configured
89+ if ( runtimeConfigOptions . auth ?. google ) {
90+ const googleOAuthEndpoints = [
91+ `${ apiBasePath } /auth/google/redirect` ,
92+ `${ apiBasePath } /auth/google/callback`
93+ ]
94+
95+ googleOAuthEndpoints . forEach ( ( endpoint ) => {
96+ if ( ! combinedWhitelist . includes ( endpoint ) ) {
97+ combinedWhitelist . push ( endpoint )
98+ }
99+ } )
100+ }
101+
86102 return combinedWhitelist
87- } ) ( ) ,
103+ } ) ( )
88104 } ,
89105 }
90106
@@ -95,9 +111,10 @@ export default defineNuxtModule<RuntimeModuleOptions>({
95111 auth : {
96112 whitelist : ( ( ) => {
97113 const combinedWhitelist = [ ...( defaultOptions . auth ?. whitelist || [ ] ) , ...( runtimeConfigOptions . auth ?. whitelist || [ ] ) ]
114+ const apiBasePath = runtimeConfigOptions . apiBasePath || defaultOptions . apiBasePath
115+
98116 // Auto-whitelist related endpoints if /register is whitelisted
99117 if ( combinedWhitelist . includes ( '/register' ) ) {
100- const apiBasePath = runtimeConfigOptions . apiBasePath || defaultOptions . apiBasePath
101118 const registrationEndpoints = [
102119 '/confirm-email' , // Page route for email confirmation
103120 `${ apiBasePath } /register` , // API endpoint for registration
@@ -110,8 +127,23 @@ export default defineNuxtModule<RuntimeModuleOptions>({
110127 }
111128 } )
112129 }
130+
131+ // Auto-whitelist Google OAuth endpoints if Google OAuth is configured
132+ if ( runtimeConfigOptions . auth ?. google ) {
133+ const googleOAuthEndpoints = [
134+ `${ apiBasePath } /auth/google/redirect` ,
135+ `${ apiBasePath } /auth/google/callback`
136+ ]
137+
138+ googleOAuthEndpoints . forEach ( ( endpoint ) => {
139+ if ( ! combinedWhitelist . includes ( endpoint ) ) {
140+ combinedWhitelist . push ( endpoint )
141+ }
142+ } )
143+ }
144+
113145 return combinedWhitelist
114- } ) ( ) ,
146+ } ) ( )
115147 permissions : runtimeConfigOptions . auth ?. permissions || defaultOptions . auth . permissions
116148 } ,
117149 apiBasePath : runtimeConfigOptions . apiBasePath || defaultOptions . apiBasePath
0 commit comments