Skip to content

Commit

Permalink
fix: fix auth header
Browse files Browse the repository at this point in the history
  • Loading branch information
JellyBrick committed Sep 30, 2023
1 parent f806ffa commit 7124359
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
17 changes: 15 additions & 2 deletions src/main/kotlin/be/zvz/kotlininside/security/Auth.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Auth {
brand = "google"
radio = "FLO-04.04"
clientId = "android-google"
sdkVersion = 25
sdkVersion = Const.Firebase.OS_VERSION.toInt()
}
lastCheckinMs = 0
}
Expand Down Expand Up @@ -104,6 +104,9 @@ class Auth {
.addBodyParameter("sender", clientToken)
.addBodyParameter("X-gcm.topic", scope)
.addBodyParameter("X-app_ver", Const.DC_APP_VERSION_CODE)
.addBodyParameter("X-osv", Const.Firebase.OS_VERSION)
.addBodyParameter("X-cliv", Const.Firebase.CLIV)
.addBodyParameter("X-gmsv", Const.Firebase.GCM_VERSION)
.addBodyParameter("X-appid", fid ?: "")
.addBodyParameter("X-scope", scope)
.addBodyParameter("X-Goog-Firebase-Installations-Auth", installationToken)
Expand All @@ -113,7 +116,11 @@ class Auth {
.addBodyParameter("app", Const.Register3.APP)
.addBodyParameter("device", androidCheckin.androidId.toString())
.addBodyParameter("app_ver", Const.DC_APP_VERSION_CODE)
.addBodyParameter("info", Const.Firebase.INFO)
.addBodyParameter("plat", "0")
.addBodyParameter("gcm_ver", Const.Register3.GCM_VERSION)
.addBodyParameter("cert", Const.Register3.CERT)
.addBodyParameter("target_ver", Const.Firebase.TARGET_VER)
)
}

Expand Down Expand Up @@ -159,6 +166,9 @@ class Auth {
.addBodyParameter("X-subtype", Const.Register3.SENDER)
.addBodyParameter("sender", Const.Register3.SENDER)
.addBodyParameter("X-app_ver", Const.DC_APP_VERSION_CODE)
.addBodyParameter("X-osv", Const.Firebase.OS_VERSION)
.addBodyParameter("X-cliv", Const.Firebase.CLIV)
.addBodyParameter("X-gmsv", Const.Firebase.GCM_VERSION)
.addBodyParameter("X-appid", fid ?: "")
.addBodyParameter("X-scope", Const.Register3.X_SCOPE_ALL)
.addBodyParameter("X-Goog-Firebase-Installations-Auth", token)
Expand All @@ -168,8 +178,11 @@ class Auth {
.addBodyParameter("app", Const.Register3.APP)
.addBodyParameter("device", androidCheckin.androidId.toString())
.addBodyParameter("app_ver", Const.DC_APP_VERSION_CODE)
.addBodyParameter("info", Const.Firebase.INFO)
.addBodyParameter("plat", "0")
.addBodyParameter("gcm_ver", Const.Register3.GCM_VERSION)
.addBodyParameter("cert", Const.Register3.CERT)
.addBodyParameter("target_ver", Const.Firebase.TARGET_VER)
) ?: throw RuntimeException("Can't get client_token")

val clientToken = register3.split('=')[1]
Expand All @@ -189,7 +202,7 @@ class Auth {
"application/json",
JsonBrowser.getMapper().writeValueAsString(
JsonBrowser.getMapper().createObjectNode()?.apply {
put("platformVersion", "25")
put("platformVersion", Const.Firebase.OS_VERSION)
put("appInstanceId", fid ?: "")
put("packageName", Const.DC_APP_PACKAGE)
put("appVersion", Const.DC_APP_VERSION_NAME)
Expand Down
8 changes: 7 additions & 1 deletion src/main/kotlin/be/zvz/kotlininside/value/Const.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ object Const {
const val DC_APP_PACKAGE = "com.dcinside.app.android"
const val DC_APP_VERSION_CODE = "100051"
const val DC_APP_VERSION_NAME = "4.8.1"
const val DC_APP_TARGET_VERSION = "33"
const val USER_AGENT = "dcinside.app"

object Firebase {
Expand All @@ -14,6 +15,11 @@ object Const {
const val SDK_VERSION = "a:17.1.0"
const val REMOTE_CONFIG_SDK_VERSION = "21.2.1"
const val CERT = "43bd70dfc365ec1749f0424d28174da44ee7659d"
const val OS_VERSION = "25"
const val CLIV = "fcm-23.1.1"
const val INFO = "Q2U3ar09NyAToOhBO1boBVw1nzmBjxg"
const val TARGET_VER = DC_APP_TARGET_VERSION
const val GCM_VERSION = "232512022"
}

object Installations {
Expand All @@ -30,7 +36,7 @@ object Const {
const val X_FIREBASE_APP_NAME_HASH = "R1dAH9Ui7M-ynoznwBdw01tLxhI"
const val USER_AGENT = "Android-GCM/1.5"
const val APP = DC_APP_PACKAGE
const val GCM_VERSION = "232512022"
const val GCM_VERSION = Firebase.GCM_VERSION
const val CERT = Firebase.CERT
}
}

0 comments on commit 7124359

Please sign in to comment.