@@ -69,23 +69,35 @@ export const ENV_URLS = {
6969} ;
7070
7171// OAuth Web Client Configuration (for authorization code flow)
72+ // Function to get OAuth client ID with proper runtime support
73+ function getOAuthClientId ( ) : string {
74+ // Try runtime environment first (for Azure App Service)
75+ const runtimeClientId = ( window as any ) ?. env ?. VITE_OAUTH_WEB_CLIENT_ID ;
76+ if ( runtimeClientId && runtimeClientId !== '__VITE_OAUTH_WEB_CLIENT_ID__' ) {
77+ return runtimeClientId ;
78+ }
79+ // Fallback to build-time environment variable
80+ return import . meta. env . VITE_OAUTH_WEB_CLIENT_ID || '' ;
81+ }
82+
83+ // Function to get OAuth client secret with proper runtime support
84+ function getOAuthClientSecret ( ) : string {
85+ // Try runtime environment first (for Azure App Service)
86+ const runtimeClientSecret = ( window as any ) ?. env ?. VITE_OAUTH_WEB_CLIENT_SECRET ;
87+ if ( runtimeClientSecret && runtimeClientSecret !== '__VITE_OAUTH_WEB_CLIENT_SECRET__' ) {
88+ return runtimeClientSecret ;
89+ }
90+ // Fallback to build-time environment variable
91+ return import . meta. env . VITE_OAUTH_WEB_CLIENT_SECRET || '' ;
92+ }
93+
7294export const OAUTH_CONFIG = {
73- webClientId : ( ( ) => {
74- // Try runtime environment first (for Azure App Service)
75- const runtimeClientId = ( window as any ) ?. env ?. VITE_OAUTH_WEB_CLIENT_ID ;
76- if ( runtimeClientId && runtimeClientId !== '__VITE_OAUTH_WEB_CLIENT_ID__' ) {
77- return runtimeClientId ;
78- }
79- return import . meta. env . VITE_OAUTH_WEB_CLIENT_ID || '' ;
80- } ) ( ) ,
81- webClientSecret : ( ( ) => {
82- // Try runtime environment first (for Azure App Service)
83- const runtimeClientSecret = ( window as any ) ?. env ?. VITE_OAUTH_WEB_CLIENT_SECRET ;
84- if ( runtimeClientSecret && runtimeClientSecret !== '__VITE_OAUTH_WEB_CLIENT_SECRET__' ) {
85- return runtimeClientSecret ;
86- }
87- return import . meta. env . VITE_OAUTH_WEB_CLIENT_SECRET || '' ;
88- } ) ( ) ,
95+ get webClientId ( ) {
96+ return getOAuthClientId ( ) ;
97+ } ,
98+ get webClientSecret ( ) {
99+ return getOAuthClientSecret ( ) ;
100+ } ,
89101 redirectUri : ( ( ) => {
90102 // Build redirect URI dynamically from current window location
91103 // This automatically works for localhost, dev, staging, and production environments
0 commit comments