From 61f679387311c88ca8e8a2d28a392cbcdc456d55 Mon Sep 17 00:00:00 2001 From: frikky Date: Thu, 19 Aug 2021 01:23:59 +0200 Subject: [PATCH] #168: Minor fixes to oauth2 control --- frontend/src/components/ParsedAction.jsx | 10 ++++++++-- frontend/src/views/AngularWorkflow.jsx | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 2ee180fb..e5b9bdd8 100644 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -1394,15 +1394,21 @@ const ParsedAction = (props) => { // FIXME: Sending client secret and senitive info like this may not be ok. const client_id = "dae24316-4bec-4832-b660-4cba6dc2477b" const client_secret = "._Qu3EvYY-OW_D57uy79qwEo.32qD6.l0z" - const authentication_url = "https://login.microsoftonline.com/common/oauth2/v2.0/token" + + const authentication_url = authenticationType.token_uri + const resources = "UserAuthenticationMethod.ReadWrite.All" + if (authenticationType.scope !== undefined && authenticationType.scope !== null) { + console.log("EDIT SCOPE!") + } const redirectUri = `http://${window.location.host}/set_authentication` const state = `workflow_id%3D${workflow.id}%26reference_action_id%3d${selectedAction.app_id}%26app_name%3d${selectedAction.app_name}%26app_id%3d${selectedAction.app_id}%26app_version%3d${selectedAction.app_version}%26authentication_url%3d${authentication_url}%26scope%3d${resources}%26client_id%3d${client_id}%26client_secret%3d${client_secret}` - const url = `https://login.microsoftonline.com/common/oauth2/authorize?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&state=${state}` + const url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&scope=${resources}&state=${state}` // &resource=https%3A%2F%2Fgraph.microsoft.com& + // Awful, but works for prototyping var newwin = window.open(url, "", "width=200,height=100") console.log(newwin) setTimeout(() => { diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index ef117a88..0825aaf4 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1950,6 +1950,8 @@ const AngularWorkflow = (props) => { { "type": "oauth2", "redirect_uri": curapp.authentication.redirect_uri, + "token_uri": curapp.authentication.token_uri, + "scope": curapp.authentication.scope, } : { "type": "" }