Merge pull request #33471 from overleaf/copilot/fix-git-integration-prompts

Fix incorrect auth error messages shown to git bridge users

GitOrigin-RevId: 52888e991cf1ec7f3ae28c67fcd70fa2a1a9fad9
This commit is contained in:
David
2026-05-27 13:31:39 +01:00
committed by Copybot
parent bc8008737c
commit b6b03a2091
@@ -198,29 +198,18 @@ public class Oauth2Filter implements Filter {
throws IOException {
Log.debug("[{}] Unauthorized, User '{}' ip={}", projectId, username, getClientIp(request));
response.setHeader("WWW-Authenticate", "Basic realm=\"Git Bridge\"");
if (this.isUserPasswordEnabled) {
sendResponse(
response,
401,
Arrays.asList(
"Log in using the email address and password you use for Overleaf.",
"",
"*Note*: if you use a provider such as Google or Twitter to sign into",
"your Overleaf account, you will need to set a password.",
"",
"See our help page for more support:",
"https://www.overleaf.com/learn/how-to/Troubleshooting_git_bridge_problems"));
} else {
sendResponse(
response,
401,
Arrays.asList(
"Log in with the username 'git' and enter your Git authentication token",
"when prompted for a password.",
"",
"You can generate and manage your Git authentication tokens in",
"your Overleaf Account Settings."));
}
sendResponse(
response,
401,
Arrays.asList(
"Log in with the username 'git' and enter your Git authentication token",
"when prompted for a password.",
"",
"You can generate and manage your Git authentication tokens in",
"your Overleaf Account Settings.",
"",
"See our help page for more support:",
"https://www.overleaf.com/learn/how-to/Git_integration"));
}
private void handleBadAccessToken(
@@ -234,7 +223,10 @@ public class Oauth2Filter implements Filter {
"Enter your Git authentication token when prompted for a password.",
"",
"You can generate and manage your Git authentication tokens in",
"your Overleaf Account Settings."));
"your Overleaf Account Settings.",
"",
"See our help page for more support:",
"https://www.overleaf.com/learn/how-to/Git_integration"));
}
private int checkAccessToken(String oauth2Server, String accessToken, String clientIp)