Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: improve error message for oauth exchange (#2954)

Yilong Lic387ea6faff0
diff --git a/server/oauth.go b/server/oauth.go
index c9d989183a..ea14f1cbad 100644
--- a/server/oauth.go
+++ b/server/oauth.go
@@ -75,7 +75,7 @@ func (s *Server) registerOAuthRoutes(g *echo.Group) {
oauthExchange,
)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, oauthErrorMessage(oauthExchange.RedirectURL)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, oauthErrorMessage(s.profile.ExternalURL)).SetInternal(err)
}
resp := &api.OAuthToken{
diff --git a/server/server_frontend_embed.go b/server/server_frontend_embed.go
index dbbee22cf5..3a617bf737 100644
--- a/server/server_frontend_embed.go
+++ b/server/server_frontend_embed.go
@@ -51,6 +51,6 @@ func oauthRedirectURL(externalURL string) string {
return externalURL
}
-func oauthErrorMessage(redirectURL string) string {
- return fmt.Sprintf("Failed to exchange OAuth token. Make sure --external-url: %s matches your browser host.", redirectURL)
+func oauthErrorMessage(externalURL string) string {
+ return fmt.Sprintf("Failed to exchange OAuth token. Make sure --external-url %s matches your browser host. Note that if you are not using port 80 or 443, you should also specify the port such as --external-url=http://host:port", externalURL)
}
diff --git a/server/server_frontend_not_embed.go b/server/server_frontend_not_embed.go
index 9691cf1de4..168a1b8342 100644
--- a/server/server_frontend_not_embed.go
+++ b/server/server_frontend_not_embed.go
@@ -31,6 +31,6 @@ func oauthRedirectURL(_ string) string {
return "http://localhost:3000"
}
-func oauthErrorMessage(redirectURL string) string {
- return fmt.Sprintf("Failed to exchange OAuth token. Make sure BB_REDIRECT_URL: %s matches your browser host.", redirectURL)
+func oauthErrorMessage(externalURL string) string {
+ return fmt.Sprintf("Failed to exchange OAuth token. Make sure BB_REDIRECT_URL: %s matches your browser host. Note that if you are not using port 80 or 443, you should also specify the port such as --external-url=http://host:port", externalURL)
}