diff --git a/web_server.py b/web_server.py index 3dcaf068..bf8a1f06 100644 --- a/web_server.py +++ b/web_server.py @@ -2457,7 +2457,66 @@ def auth_spotify(): # Get the authorization URL auth_url = temp_spotify_client.sp.auth_manager.get_authorize_url() add_activity_item("🔐", "Spotify Auth Started", "Please complete OAuth in browser", "Now") - return f'

🔐 Spotify Authentication

Please visit this URL to authenticate:

{auth_url}

After authentication, return to the app.

' + + # Detect if accessing remotely + host = request.host.split(':')[0] + is_remote = host not in ['127.0.0.1', 'localhost'] + + if is_remote: + # Show instructions for remote access + return f''' + + + + + +

🔐 Spotify Authentication (Remote Access)

+

Step 1: Click the link below to authenticate with Spotify

+

{auth_url}

+
+

Step 2: After authorizing, you'll see a blank page. The URL will look like:

+ http://127.0.0.1:8888/callback?code=... +

Step 3: Change 127.0.0.1 to {host} and press Enter: + +

+ http://{host}:8888/callback?code=... +

Authentication will then complete!

+ + + + + ''' + else: + # Local access - simple message + return f'

🔐 Spotify Authentication

Click the link below to authenticate:

{auth_url}

After authentication, return to the app.

' else: return "

❌ Spotify Authentication Failed

Could not initialize Spotify client. Check your credentials.

", 400 except Exception as e: