Skip to content

Commit c972267

Browse files
authored
fix(Spotify - Spoof client): Fix login failing by spoofing login request in addition (#5448)
1 parent d0d2c13 commit c972267

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ internal val loadOrbitLibraryFingerprint = fingerprint {
1111
strings("/liborbit-jni-spotify.so")
1212
}
1313

14+
internal val setClientIdFingerprint = fingerprint {
15+
parameters("Ljava/lang/String;")
16+
custom { method, classDef ->
17+
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
18+
&& method.name == "setClientId"
19+
}
20+
}
21+
22+
internal val setUserAgentFingerprint = fingerprint {
23+
parameters("Ljava/lang/String;")
24+
custom { method, classDef ->
25+
classDef.type == "Lcom/spotify/connectivity/ApplicationScopeConfiguration;"
26+
&& method.name == "setDefaultHTTPUserAgent"
27+
}
28+
}
29+
1430
internal val extensionFixConstantsFingerprint = fingerprint {
1531
custom { _, classDef -> classDef.type == "Lapp/revanced/extension/spotify/misc/fix/Constants;" }
1632
}

patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofClientPatch.kt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package app.revanced.patches.spotify.misc.fix
22

3+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
34
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
45
import app.revanced.patcher.patch.bytecodePatch
56
import app.revanced.patcher.patch.intOption
@@ -72,7 +73,29 @@ val spoofClientPatch = bytecodePatch(
7273
compatibleWith("com.spotify.music")
7374

7475
execute {
75-
// region Spoof client.
76+
val clientVersion = clientVersion!!
77+
val hardwareMachine = hardwareMachine!!
78+
val systemVersion = systemVersion!!
79+
80+
// region Spoof login request.
81+
82+
val version = clientVersion
83+
.substringAfter('-')
84+
.substringBeforeLast('.')
85+
.substringBeforeLast('.')
86+
87+
setUserAgentFingerprint.method.addInstruction(
88+
0,
89+
"const-string p1, \"Spotify/$version iOS/$systemVersion ($hardwareMachine)\""
90+
)
91+
92+
setClientIdFingerprint.method.addInstruction(
93+
0, "const-string p1, \"58bd3c95768941ea9eb4350aaa033eb3\""
94+
)
95+
96+
// endregion
97+
98+
// region Spoof client-token request.
7699

77100
loadOrbitLibraryFingerprint.method.addInstructions(
78101
0,
@@ -83,9 +106,9 @@ val spoofClientPatch = bytecodePatch(
83106
)
84107

85108
mapOf(
86-
"getClientVersion" to clientVersion!!,
87-
"getSystemVersion" to systemVersion!!,
88-
"getHardwareMachine" to hardwareMachine!!
109+
"getClientVersion" to clientVersion,
110+
"getSystemVersion" to systemVersion,
111+
"getHardwareMachine" to hardwareMachine
89112
).forEach { (methodName, value) ->
90113
extensionFixConstantsFingerprint.classDef.methods.single { it.name == methodName }.returnEarly(value)
91114
}

0 commit comments

Comments
 (0)