fix: GOG sign-in pages use the browser's own user agent

The GOG sign-in WebView sent GOG Galaxy's Windows user agent, while the
page's scripts and client hints report an Android WebView. Cloudflare's
bot check on gog.com compares the two, and the mismatch can keep the
challenge from passing.

The sign-in flow now receives the same Chrome user agent the Epic client
sign-in and the Google, Facebook and Apple pages already get (the
WebView's own, without its WebView markers). API calls outside the
WebView keep the Galaxy user agent.
This commit is contained in:
Diego Ramos authored and The412Banner committed 2026-10-25 03:29:13 +00:00
1 parent c5d7cdc058
commit ad60bf2abb
2 files changed
+4 -5

No files matched your search

@@ -8,8 +8,8 @@ import com.droiddeck.launcher.stores.gog.GogAuth
internal object LoginFlows {
private const val TAG = "StoreLogin"
fun forStore(store: Store, state: String): StoreLoginActivity.Flow? = when (store) {
Store.GOG -> GogFlow(state)
fun forStore(store: Store, state: String, browserUserAgent: String): StoreLoginActivity.Flow? = when (store) {
Store.GOG -> GogFlow(state, browserUserAgent)
Store.EPIC -> epicFlow()
Store.AMAZON -> amazonFlow()
Store.ITCH, Store.XBOX -> null
@@ -18,9 +18,8 @@ internal object LoginFlows {
@Volatile var epicFlow: () -> StoreLoginActivity.Flow? = { null }
@Volatile var amazonFlow: () -> StoreLoginActivity.Flow? = { null }
private class GogFlow(private val state: String) : StoreLoginActivity.Flow {
private class GogFlow(private val state: String, override val userAgent: String) : StoreLoginActivity.Flow {
override val startUrl: String get() = GogAuth.authUrl(state)
override val userAgent: String get() = GogAuth.GALAXY_UA
override fun isRedirect(url: String): Boolean = url.startsWith(GogAuth.REDIRECT_PREFIX)
override fun forgetSignIn(done: () -> Unit) {
@@ -130,7 +130,7 @@ class StoreLoginActivity : ComponentActivity() {
private fun newFlow(state: String): Flow? {
val url = clientUrl
if (url != null) return com.droiddeck.launcher.stores.epic.EpicClient.loginFlow(url, chromeUa)
return store?.let { LoginFlows.forStore(it, state) }
return store?.let { LoginFlows.forStore(it, state, chromeUa) }
}
override fun finish() {