mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-21 12:51:16 +08:00
fix(editor): Fix OAuth2 credential showing "Needs first setup" after connecting (#29617)
This commit is contained in:
+1
@@ -1183,6 +1183,7 @@ async function deleteCredential() {
|
||||
async function oAuthCredentialAuthorize() {
|
||||
let url;
|
||||
|
||||
credentialsStore.pendingOAuthRefresh = true;
|
||||
const credential = await saveCredential();
|
||||
if (!credential) {
|
||||
return;
|
||||
|
||||
@@ -44,6 +44,8 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||
type CredentialTestStatus = 'pending' | 'success' | 'error';
|
||||
const credentialTestResults = ref(new Map<string, CredentialTestStatus>());
|
||||
|
||||
const pendingOAuthRefresh = ref(false);
|
||||
|
||||
const isCredentialTestedOk = (id: string): boolean => {
|
||||
return credentialTestResults.value.get(id) === 'success';
|
||||
};
|
||||
@@ -520,6 +522,7 @@ export const useCredentialsStore = defineStore(STORES.CREDENTIALS, () => {
|
||||
getCredentialTranslation,
|
||||
setCredentialSharedWith,
|
||||
claimFreeAiCredits,
|
||||
pendingOAuthRefresh,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -145,6 +145,14 @@ listenForModalChanges({
|
||||
if ([CREDENTIAL_SELECT_MODAL_KEY, CREDENTIAL_EDIT_MODAL_KEY].includes(modalName as string)) {
|
||||
void router.replace({ params: { credentialId: '' }, query: route.query });
|
||||
}
|
||||
if (modalName === CREDENTIAL_EDIT_MODAL_KEY && credentialsStore.pendingOAuthRefresh) {
|
||||
credentialsStore.pendingOAuthRefresh = false;
|
||||
void credentialsStore.fetchAllCredentials({
|
||||
projectId: route?.params?.projectId as string | undefined,
|
||||
includeScopes: true,
|
||||
externalSecretsStore: filters.value.externalSecretsStore,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user