Bug: Support translations for Cookie Acquisition error (#6917)

This commit is contained in:
David Perez
2026-05-13 20:05:53 +00:00
committed by GitHub
parent 8fe23ad275
commit e4f030d0e3
17 changed files with 94 additions and 31 deletions
@@ -13,6 +13,5 @@ import java.io.IOException
*/
class CookieRedirectException(
val hostname: String,
) : IOException(
"Your request was interrupted because the app needed to re-authenticate. Please try again.",
)
message: String,
) : IOException(message)
@@ -60,7 +60,10 @@ internal class CookieInterceptor(
if (cookieProvider.needsBootstrap(hostname)) {
Timber.d("Cookie bootstrap required for $hostname, triggering acquisition")
cookieProvider.acquireCookies(hostname)
throw CookieRedirectException(hostname = hostname)
throw CookieRedirectException(
hostname = hostname,
message = cookieProvider.errorMessageString,
)
}
val request = originalRequest.withCookies(hostname)
@@ -77,6 +80,7 @@ internal class CookieInterceptor(
cookieProvider.acquireCookies(hostname)
throw CookieRedirectException(
hostname = hostname,
message = cookieProvider.errorMessageString,
)
}
@@ -10,6 +10,11 @@ import com.bitwarden.network.model.NetworkCookie
* Bitwarden API endpoints behind a load balancer.
*/
interface CookieProvider {
/**
* The translated human-readable string to be displayed when the missing cookie is the reason
* for a request failure.
*/
val errorMessageString: String
/**
* Determines if the given [hostname] requires cookie bootstrap.