Browse Source

make frontend_url optional for oauth configuration

Anish Mukherjee 2 years ago
parent
commit
8ae9896ea3
1 changed files with 4 additions and 4 deletions
  1. 4 4
      auth/auth.go

+ 4 - 4
auth/auth.go

@@ -72,10 +72,6 @@ func InitializeAuthProvider() string {
 		logger.Log(0, err.Error())
 		logger.Log(0, err.Error())
 		return ""
 		return ""
 	}
 	}
-	var currentFrontendURL = servercfg.GetFrontendURL()
-	if currentFrontendURL == "" {
-		return ""
-	}
 	var authInfo = servercfg.GetAuthProviderInfo()
 	var authInfo = servercfg.GetAuthProviderInfo()
 	var serverConn = servercfg.GetAPIHost()
 	var serverConn = servercfg.GetAPIHost()
 	if strings.Contains(serverConn, "localhost") || strings.Contains(serverConn, "127.0.0.1") {
 	if strings.Contains(serverConn, "localhost") || strings.Contains(serverConn, "127.0.0.1") {
@@ -133,6 +129,10 @@ func HandleAuthLogin(w http.ResponseWriter, r *http.Request) {
 	if functions == nil {
 	if functions == nil {
 		return
 		return
 	}
 	}
+	if servercfg.GetFrontendURL() == "" {
+		handleOauthNotConfigured(w)
+		return
+	}
 	functions[handle_login].(func(http.ResponseWriter, *http.Request))(w, r)
 	functions[handle_login].(func(http.ResponseWriter, *http.Request))(w, r)
 }
 }