Closed ao-david closed 5 days ago
This issue is caused by the implementation of pattern matching by this function:
// genToken redirects the user to an authorisation page for generation of an // authorisation token. func genToken(w http.ResponseWriter, r *http.Request, config *oauth2.Config, url string) { config.RedirectURL = "https://" + r.Host + youtubeCredsRedirect http.HandleFunc( youtubeCredsRedirect, func(w http.ResponseWriter, r *http.Request) { code := r.FormValue("code") tok, err := config.Exchange(context.Background(), code) if err != nil { log.Printf("could not exchange token: %v", err) } if production { err = saveTokObj(context.Background(), tok, url) } else { err = saveTokFile(tok, url) } if err != nil { log.Printf("could not save new token: %v", err) } completionRedirect := "https://" + r.Host + "/admin/broadcast" http.Redirect(w, r, completionRedirect, http.StatusSeeOther) }, ) authURL := config.AuthCodeURL("state-token", oauth2.AccessTypeOffline) http.Redirect(w, r, authURL, http.StatusSeeOther) }
This was implemented like this to allow for the closure to access the config whilst still matching the pattern required for a http handler.
Addressed in #164
This issue is caused by the implementation of pattern matching by this function:
This was implemented like this to allow for the closure to access the config whilst still matching the pattern required for a http handler.![image](https://github.com/ausocean/cloud/assets/160693812/2d6c139d-fe91-4045-ae70-f1264d091fd1)