feat: improve Login5 authentication with token renewal
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
@@ -14,11 +14,15 @@ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(level
|
||||
def test_zeroconf_login5():
|
||||
"""Test Login5 using Zeroconf authentication"""
|
||||
print("=== Testing Login5 with Zeroconf ===")
|
||||
print("IMPORTANT: This test requires a Spotify Connect transfer!")
|
||||
print("1. Open Spotify on your phone/computer")
|
||||
print("2. Look for 'librespot-spotizerr' in Spotify Connect devices")
|
||||
print("3. Transfer playback to it")
|
||||
print("4. Wait for credentials to be stored...")
|
||||
print("2. Start playing some music")
|
||||
print("3. Look for 'librespot-spotizerr' in Spotify Connect devices")
|
||||
print("4. Click on 'librespot-spotizerr' to transfer playback to it")
|
||||
print("5. Wait for credentials to be stored...")
|
||||
print("\nWaiting for Spotify Connect transfer...")
|
||||
print("NOTE: You'll see 'Created new session!' logs - this is normal startup.")
|
||||
print("The test will only succeed when you transfer playback from Spotify Connect.")
|
||||
|
||||
zs = ZeroconfServer.Builder().create()
|
||||
|
||||
@@ -37,8 +41,9 @@ def test_zeroconf_login5():
|
||||
print("- Transfer playback to it")
|
||||
return False
|
||||
|
||||
if zs._ZeroconfServer__session:
|
||||
session = zs._ZeroconfServer__session
|
||||
# Check for session
|
||||
session = zs.get_session()
|
||||
if session:
|
||||
print(f"\n✓ Got session for user: {session.username()}")
|
||||
|
||||
# Test token retrieval
|
||||
@@ -47,10 +52,10 @@ def test_zeroconf_login5():
|
||||
token = token_provider.get("playlist-read")
|
||||
print(f"✓ Got playlist-read token: {token[:20]}...")
|
||||
|
||||
# Test Login5 token
|
||||
login5_token = session.get_login5_token()
|
||||
# Test Login5 token by requesting a different scope using get_token
|
||||
login5_token = token_provider.get_token("user-read-email", "user-read-private")
|
||||
if login5_token:
|
||||
print(f"✓ Login5 token available: {login5_token[:20]}...")
|
||||
print(f"✓ Login5 token available: {login5_token.access_token[:20]}...")
|
||||
else:
|
||||
print("⚠ Login5 token not available")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user