World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#7947] fix(web): Prevent OAuth headers from being sent to GitHub API causing 401 errors (#8106)
Bharath Krishnaa7af6033a6f8
diff --git a/web/web/src/lib/provider/session.js b/web/web/src/lib/provider/session.jsindex 1d482ff31c..5750c61dab 100644--- a/web/web/src/lib/provider/session.js+++ b/web/web/src/lib/provider/session.js@@ -77,9 +77,11 @@ const AuthProvider = ({ children }) => {const [authConfigsErr, resAuthConfigs] = await to(dispatch(getAuthConfigs()))const authType = resAuthConfigs?.payload?.authType+ // Always fetch GitHub info since it's a public API call+ dispatch(fetchGitHubInfo())+if (authType === 'simple') {dispatch(initialVersion())- dispatch(fetchGitHubInfo())goToMetalakeListPage()} else if (authType === 'oauth') {const tokenToUse = await oauthProviderFactory.getAccessToken()@@ -90,7 +92,6 @@ const AuthProvider = ({ children }) => {if (tokenToUse) {dispatch(setAuthToken(tokenToUse))dispatch(initialVersion())- dispatch(fetchGitHubInfo())goToMetalakeListPage()} else {// Don't redirect to login if we're on the OAuth callback pagediff --git a/web/web/src/lib/utils/axios/index.js b/web/web/src/lib/utils/axios/index.jsindex 944fa0e3ca..a0710bb08b 100644--- a/web/web/src/lib/utils/axios/index.js+++ b/web/web/src/lib/utils/axios/index.js@@ -174,12 +174,22 @@ const transform = {*/requestInterceptors: async (config, options) => {// ** Pre-Request Configuration Handling++ // Skip token retrieval for GitHub API calls entirely+ if (config.url === githubApis.GET) {+ return config+ }+// Use OAuth provider factory for proper token management- const token = await oauthProviderFactory.getAccessToken()+ try {+ const token = await oauthProviderFactory.getAccessToken()- if (token && config?.requestOptions?.withToken !== false) {- // ** jwt token- config.headers.Authorization = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token+ if (token && config?.requestOptions?.withToken !== false) {+ // ** jwt token+ config.headers.Authorization = options.authenticationScheme ? `${options.authenticationScheme} ${token}` : token+ }+ } catch (error) {+ console.warn('Failed to get access token:', error)}return config