Skip to content

Commit

Permalink
Removed further comments for oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Sep 1, 2023
1 parent 73d7359 commit 26fc9bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -3914,4 +3916,4 @@ func VerifyIdToken(ctx context.Context, idToken string) (IdTokenCheck, error) {
}

return IdTokenCheck{}, errors.New("Couldn't verify nonce")
}
}
2 changes: 2 additions & 0 deletions shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26fc9bc

Please sign in to comment.