16848: Always use wb2 token when LoginCluster is set and isn't the home cluster
[arvados-workbench2.git] / src / store / auth / auth-action.ts
index 49a82b956252d5730e14c4cf4f8db9e699c83ac5..fb94746ff983b0a23502c3149d9f91b45bab5a73 100644 (file)
@@ -99,7 +99,9 @@ export const saveApiToken = (token: string) => (dispatch: Dispatch, getState: ()
 export const getNewExtraToken = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const user = getState().auth.user;
+        const loginCluster = getState().auth.config.clusterConfig.Login.LoginCluster;
         if (user === undefined) { return; }
+        if (loginCluster !== "" && getState().auth.homeCluster !== loginCluster) { return; }
         try {
             // Do not show errors on the create call, cluster security configuration may not
             // allow token creation and there's no way to know that from workbench2 side in advance.