diff --git a/patches/api/patches.api b/patches/api/patches.api index 72b3534e9..c8ef5d763 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -1,3 +1,7 @@ +public final class FixFacebookLoginPatchKt { + public static final fun getFixFacebookLoginPatch ()Lapp/revanced/patcher/patch/BytecodePatch; +} + public final class app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatchKt { public static final fun getExportAllActivitiesPatch ()Lapp/revanced/patcher/patch/ResourcePatch; } diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofSignaturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofSignaturePatch.kt index 7ac278ff3..d59969c6c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofSignaturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofSignaturePatch.kt @@ -7,7 +7,5 @@ import app.revanced.patcher.patch.bytecodePatch val spoofSignaturePatch = bytecodePatch( description = "Spoofs the signature of the app fix various functions of the app.", ) { - compatibleWith("com.spotify.music") - dependsOn(spoofPackageInfoPatch) } diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/Fingerprints.kt new file mode 100644 index 000000000..b9edaaeac --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/Fingerprints.kt @@ -0,0 +1,13 @@ +package app.revanced.patches.spotify.misc.fix.login + +import app.revanced.patcher.fingerprint +import app.revanced.util.literal + +internal val katanaProxyLoginMethodHandlerClassFingerprint = fingerprint { + strings("katana_proxy_auth") +} + +internal val katanaProxyLoginMethodTryAuthorizeFingerprint = fingerprint { + strings("e2e") + literal { 0 } +} diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt new file mode 100644 index 000000000..dc9179854 --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt @@ -0,0 +1,29 @@ +package app.revanced.patches.spotify.misc.fix.login + +import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly + +@Suppress("unused") +val fixFacebookLoginPatch = bytecodePatch( + name = "Fix Facebook login", + description = + "Fix logging in with Facebook when the app is patched by always opening the login in a web browser window.", +) { + compatibleWith("com.spotify.music") + + execute { + // The Facebook SDK tries to handle the login using the Facebook app in case it is installed. + // However, the Facebook app does signature checks with the app that is requesting the authentication, + // which ends up making the Facebook server reject with an invalid key hash for the app signature. + // Override the Faceboook SDK to always handle the login using the web browser, which does not perform + // signature checks. + + val katanaProxyLoginMethodHandlerClass = katanaProxyLoginMethodHandlerClassFingerprint.originalClassDef + // Always return 0 (no Intent was launched) as the result of trying to authorize with the Facebook app to + // make the login fallback to a web browser window. + katanaProxyLoginMethodTryAuthorizeFingerprint + .match(katanaProxyLoginMethodHandlerClass) + .method + .returnEarly(0) + } +}