@superfan-app/spotify-auth 0.1.75 → 0.1.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -436,6 +436,27 @@ class SpotifyAuthAuth private constructor(private val appContext: AppContext) {
|
|
|
436
436
|
fun handleNewIntent(intent: Intent) {
|
|
437
437
|
Log.d(TAG, "handleNewIntent called - action=${intent.action}, data=${intent.data}")
|
|
438
438
|
|
|
439
|
+
// Guard: only process intents whose data URI matches our Spotify redirect URI
|
|
440
|
+
// (scheme + host). Any other onNewIntent (push notification tap, other deep links,
|
|
441
|
+
// navigation events) arriving while isAuthenticating=true would otherwise be
|
|
442
|
+
// processed by AuthorizationClient.getResponse(), which returns EMPTY for
|
|
443
|
+
// non-Spotify intents. That EMPTY result fires a UserCancelled error and resets
|
|
444
|
+
// isAuthenticating=false, so the real Spotify callback is silently dropped when
|
|
445
|
+
// it eventually arrives.
|
|
446
|
+
val intentData = intent.data
|
|
447
|
+
if (intentData != null) {
|
|
448
|
+
try {
|
|
449
|
+
val configuredUri = Uri.parse(redirectURL)
|
|
450
|
+
if (intentData.scheme != configuredUri.scheme || intentData.host != configuredUri.host) {
|
|
451
|
+
Log.d(TAG, "Ignoring new intent - data URI doesn't match redirect URI (got scheme=${intentData.scheme}, host=${intentData.host})")
|
|
452
|
+
return
|
|
453
|
+
}
|
|
454
|
+
} catch (e: SpotifyAuthException.MissingConfiguration) {
|
|
455
|
+
Log.w(TAG, "Cannot verify redirect URI in handleNewIntent: ${e.message}")
|
|
456
|
+
// Proceed and let getResponse() decide
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
439
460
|
if (!isAuthenticating) {
|
|
440
461
|
Log.d(TAG, "Ignoring new intent - not currently authenticating")
|
|
441
462
|
return
|