From 4211a2bb3ccda5698fc3c284d9f5c468eb575d12 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 23 Feb 2018 10:08:35 -0500 Subject: Fall back to constructured URL for OAuth SSO if SiteURL not set (#8352) --- app/oauth.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/oauth.go') diff --git a/app/oauth.go b/app/oauth.go index b9001ee0b..630fd3e2d 100644 --- a/app/oauth.go +++ b/app/oauth.go @@ -600,7 +600,12 @@ func (a *App) GetAuthorizationCode(w http.ResponseWriter, r *http.Request, servi props["token"] = stateToken.Token state := b64.StdEncoding.EncodeToString([]byte(model.MapToJson(props))) - redirectUri := a.GetSiteURL() + "/signup/" + service + "/complete" + siteUrl := a.GetSiteURL() + if strings.TrimSpace(siteUrl) == "" { + siteUrl = GetProtocol(r) + "://" + r.Host + } + + redirectUri := siteUrl + "/signup/" + service + "/complete" authUrl := endpoint + "?response_type=code&client_id=" + clientId + "&redirect_uri=" + url.QueryEscape(redirectUri) + "&state=" + url.QueryEscape(state) -- cgit v1.2.3-1-g7c22