diff --git a/frontend/src/components/AuthenticationNormal.jsx b/frontend/src/components/AuthenticationNormal.jsx index 1140de10..271dc59a 100644 --- a/frontend/src/components/AuthenticationNormal.jsx +++ b/frontend/src/components/AuthenticationNormal.jsx @@ -56,13 +56,13 @@ const AuthenticationData = (props) => { if (!responseJson.success) { toast("Failed to set app auth: " + responseJson.reason); } else { - if (getAppAuthentication !== undefined) { - getAppAuthentication() - } + if (getAppAuthentication !== undefined) { + getAppAuthentication() + } - if (setAuthenticationModalOpen !== undefined) { - setAuthenticationModalOpen(false) - } + if (setAuthenticationModalOpen !== undefined) { + setAuthenticationModalOpen(false) + } // Needs a refresh with the new authentication.. //toast("Successfully saved new app auth") diff --git a/frontend/src/components/Oauth2Auth.jsx b/frontend/src/components/Oauth2Auth.jsx index ca51d31a..3e834341 100755 --- a/frontend/src/components/Oauth2Auth.jsx +++ b/frontend/src/components/Oauth2Auth.jsx @@ -125,7 +125,7 @@ const AuthenticationOauth2 = (props) => { const allscopes = authenticationType.scope !== undefined ? authenticationType.scope : []; - const [selectedScopes, setSelectedScopes] = React.useState(allscopes.length <= 3 ? allscopes : []) + const [selectedScopes, setSelectedScopes] = React.useState(allscopes.length > 0 && allscopes.length <= 3 ? [allscopes[0]] : []) const [manuallyConfigure, setManuallyConfigure] = React.useState( defaultConfigSet ? false : true ); @@ -301,58 +301,47 @@ const AuthenticationOauth2 = (props) => { if ((authenticationType.redirect_uri === undefined || authenticationType.redirect_uri === null || authenticationType.redirect_uri.length === 0) && (authenticationType.token_uri !== undefined && authenticationType.token_uri !== null && authenticationType.token_uri.length > 0)) { console.log("No redirect URI found, and token URI found. Assuming client credentials flow and saving directly in the database") - // Find app.configuration=true fields in the app.paramters - var parsedFields = [{ - "key": "client_id", - "value": client_id, - }, - { - "key": "client_secret", - "value": client_secret, - }, - { - "key": "scope", - "value": scopes.join(","), - }, - { - "key": "token_uri", - "value": authenticationType.token_uri, - }] + // Find app.configuration=true fields in the app.paramters + var parsedFields = [{ + "key": "client_id", + "value": client_id, + }, + { + "key": "client_secret", + "value": client_secret, + }, + { + "key": "scope", + "value": scopes.join(","), + }, + { + "key": "token_uri", + "value": authenticationType.token_uri, + }] - // Not necessary yet to do something like this due to not showing the fields anyway - /* - if (selectedApp.parameters !== undefined && selectedApp.parameters !== null && selectedApp.parameters.length > 0) { - - for (var i = 0; i < selectedApp.parameters.length; i++) { - if (selectedApp.parameters[i].configuration !== true) { - continue - } - - console.log("Found configuration field: ", selectedApp.parameters[i].key, " with example: ", selectedApp.parameters[i].example) - parsedFields.push({ - "key": selectedApp.parameters[i].key, - "value": selectedApp.parameters[i].example, - }) - } - } - */ - - - const appAuthData = { - "label": "OAuth2 for " + selectedApp.name, - "app": { - "id": selectedApp.id, - "name": selectedApp.name, - "version": selectedApp.version, - "large_image": selectedApp.large_image, + const appAuthData = { + "label": "OAuth2 for " + selectedApp.name, + "app": { + "id": selectedApp.id, + "name": selectedApp.name, + "version": selectedApp.version, + "large_image": selectedApp.large_image, }, "fields": parsedFields, "type": "oauth2-app", "reference_workflow": workflowId, - } - setNewAppAuth(appAuthData) + } - return + setNewAppAuth(appAuthData) + // Wait 1 second, then get app auth with update + // + if (getAppAuthentication !== undefined) { + setTimeout(() => { + getAppAuthentication(true, true, true); + }, 1000) + } + + return } @@ -463,9 +452,9 @@ const AuthenticationOauth2 = (props) => { //alert('"Secure Payment" window closed!'); // - if (getAppAuthentication !== undefined) { - getAppAuthentication(true, true, true); - } + if (getAppAuthentication !== undefined) { + getAppAuthentication(true, true, true); + } } else { console.log("Not closed") } diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index bb019f14..8133d485 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1713,7 +1713,9 @@ const AngularWorkflow = (defaultprops) => { }) .then((responseJson) => { if (!responseJson.success) { - toast("Failed to start: " + responseJson.reason); + //toast("Failed to start: " + responseJson.reason); + toast(responseJson.reason); + //toast.error(responseJson.reason); setExecutionRunning(false); setExecutionRequestStarted(false); stop(); @@ -16490,7 +16492,7 @@ const AngularWorkflow = (defaultprops) => { var newAuthOption = JSON.parse(JSON.stringify(authenticationOption)); var newFields = []; - console.log("Fields: ", newAuthOption.fields) + console.log("Fields: ", newAuthOption.fields) for (let authkey in newAuthOption.fields) { const value = newAuthOption.fields[authkey]; newFields.push({