bugraoz93 commented on code in PR #51657:
URL: https://github.com/apache/airflow/pull/51657#discussion_r2162434874


##########
airflow-core/src/airflow/ui/src/utils/tokenHandler.ts:
##########
@@ -36,7 +45,32 @@ const getTokenFromCookies = (): string | undefined => {
   return undefined;
 };
 
+const getRefreshedTokenFromCookies = (): string | undefined => {
+  const cookies = document.cookie.split(";");
+
+  for (const cookie of cookies) {
+    const [name, token] = cookie.split("=");
+
+    if (name?.trim() === "_refresh_token" && token !== undefined) {
+      setToken(token);
+      clearRefreshTokenCookie();
+
+      return token;
+    }
+  }
+
+  return undefined;
+};
+
 export const tokenHandler = (config: InternalAxiosRequestConfig) => {
+  const refreshToken = getRefreshedTokenFromCookies();
+
+  if (refreshToken !== undefined && localStorage.getItem(TOKEN_STORAGE_KEY) 
!== refreshToken) {
+    config.headers.Authorization = `Bearer ${refreshToken}`;
+
+    return config;
+  }
+
   const token = localStorage.getItem(TOKEN_STORAGE_KEY) ?? 
getTokenFromCookies();

Review Comment:
   Yes, especially after reverting the key changes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to