Added redirectURL argument for oauth2 callback

This commit is contained in:
da
2017-01-08 20:27:51 +01:00
parent 90e628b517
commit cecfff984c
2 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -33,9 +33,10 @@ var (
)
// startWebServer with the port provided
func startWebServer(port string, ci string, cs string) {
func startWebServer(port string, ci string, cs string, redirectURL string) {
discordOauthConfig.ClientID = ci
discordOauthConfig.ClientSecret = cs
discordOauthConfig.RedirectURL = redirectURL + "/discordCallback"
http.HandleFunc("/", handleMain)
http.HandleFunc("/discordLogin", handlediscordLogin)
http.HandleFunc("/discordCallback", handlediscordCallback)
@@ -43,7 +44,6 @@ func startWebServer(port string, ci string, cs string) {
}
func handleMain(w http.ResponseWriter, r *http.Request) {
discordOauthConfig.RedirectURL = "http://" + r.Host + "/discordCallback"
fmt.Fprintf(w, htmlIndex)
}