From 26fc9bc231348d787b54c42784909f6ee071e28c Mon Sep 17 00:00:00 2001 From: Frikky Date: Fri, 1 Sep 2023 02:45:16 +0200 Subject: [PATCH] Removed further comments for oauth --- oauth2.go | 12 +++++++----- shared.go | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/oauth2.go b/oauth2.go index 9a1291c..6ac675c 100755 --- a/oauth2.go +++ b/oauth2.go @@ -515,7 +515,7 @@ func HandleNewGmailRegister(resp http.ResponseWriter, request *http.Request) { url = fmt.Sprintf("https://%s%s", request.Host, request.URL.EscapedPath()) } - log.Printf("[DEBUG] Redirect URI: %s", url) + log.Printf("[DEBUG] GMAIL Redirect URI: %s", url) ctx := GetContext(request) _, accessToken, err := GetGmailClient(ctx, code, OauthToken{}, url) if err != nil { @@ -1657,6 +1657,8 @@ func HandleCreateOutlookSub(resp http.ResponseWriter, request *http.Request) { // Usually takes 10 attempts minimum :O // 10 * 5 = 50 seconds. That's waaay too much :( notificationURL := fmt.Sprintf("%s/api/v1/hooks/webhook_%s", project.CloudUrl, trigger.Id) + + //log.Printf("\n\nNOTIFICATION URL: %s\n\n", notificationURL) org, err := GetOrg(ctx, user.ActiveOrg.Id) if err != nil { log.Printf("[WARNING] Failed finding org when setting up outlook trigger: %s", err) @@ -1728,7 +1730,7 @@ func HandleCreateOutlookSub(resp http.ResponseWriter, request *http.Request) { } } - log.Printf("[DEBUG] NOTIFICATION URL OUTLOOK TRIGGER: %s", notificationURL) + //log.Printf("[DEBUG] NOTIFICATION URL OUTLOOK TRIGGER: %s", notificationURL) curSubscriptions, err := getOutlookSubscriptions(outlookClient) if err == nil { for _, sub := range curSubscriptions.Value { @@ -3205,7 +3207,7 @@ func GetOutlookClient(ctx context.Context, code string, accessToken OauthToken, if len(code) > 0 { access_token, err := conf.Exchange(ctx, code) if err != nil { - log.Printf("[WARNING] Access_token issue for gmail: %s", err) + log.Printf("[ERROR] Access_token issue for Outlook: %s", err) return &http.Client{}, access_token, err } @@ -3367,7 +3369,7 @@ func HandleGetGmailFolders(resp http.ResponseWriter, request *http.Request) { return } - log.Printf("AUTH: %#v", triggerAuth) + //log.Printf("AUTH: %#v", triggerAuth) //gmailClient, _, err := GetGmailClient(ctx, "", triggerAuth.OauthToken, "") gmailClient, err := RefreshGmailClient(ctx, *triggerAuth) if err != nil { @@ -3914,4 +3916,4 @@ func VerifyIdToken(ctx context.Context, idToken string) (IdTokenCheck, error) { } return IdTokenCheck{}, errors.New("Couldn't verify nonce") -} \ No newline at end of file +} diff --git a/shared.go b/shared.go index b14b045..2046e28 100755 --- a/shared.go +++ b/shared.go @@ -5487,6 +5487,8 @@ func SaveWorkflow(resp http.ResponseWriter, request *http.Request) { if !workflow.PreviouslySaved { log.Printf("[WORKFLOW INIT] NOT PREVIOUSLY SAVED - SET ACTION AUTH!") + + workflow.ID = uuid.NewV4().String() workflow.OrgId = user.ActiveOrg.Id workflow.Org = []OrgMini{user.ActiveOrg} workflow.Owner = user.Id