Skip to content

Conversation

keypop3750
Copy link

Description

This PR introduces a new browser-based authentication flow for SpotDL, allowing users to log in to Spotify without needing to create a Spotify Developer App or provide API keys. The implementation includes:

  • Browser authentication via OAuth (no client_id/client_secret required)
  • Automatic fallback to browser auth if no custom credentials are provided
  • New --browser-auth CLI flag for explicit usage
  • Updated configuration and type definitions to support browser authentication
  • Comprehensive documentation (AUTH_DOCUMENTATION.md) explaining both user and technical aspects

Related Issue

This PR addresses a usability issue for non-technical users like myself who struggle or aren't a fan of API key setup.

Motivation and Context

  • Removes the technical barrier for new users
  • Makes SpotDL accessible to everyone, including free Spotify accounts
  • Reduces rate limiting and setup complexity
  • Aligns with best practices for open-source usability

How Has This Been Tested?

  • Manual testing on Windows with both free and premium Spotify accounts
  • Verified browser authentication flow works with default and explicit CLI usage
  • Confirmed fallback logic triggers when no credentials are provided
  • Ran existing SpotDL commands to ensure compatibility
  • Documentation matches implementation

Screenshots (if appropriate)
N/A (feature is CLI/browser-based)

Types of Changes
New feature (non-breaking change which adds functionality)

My code follows the code style of this project

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed (manual verification)

Main focus: This PR is solely about making authentication easier for users. No other features or refactors are included. Please see AUTH_DOCUMENTATION.md for a full explanation of the new authentication flow.

"""

# For Linux systems, we follow the XDG Base Directory Specification
# Check if os is linux
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this code been modified? Did you force push HEAD? Rebase your edits onto the latest master/dev branch upstream.

This was implemented in #2514

@Silverarmor Silverarmor changed the base branch from master to dev October 11, 2025 00:10
redirect_uri = f"http://127.0.0.1:{cls._SERVER_PORT}/redirect"
auth_url = cls._construct_auth_url(client_id, scope, redirect_uri)

print("=" * 60)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be printing anything. Please follow project code styles.

while True:
server.handle_request()
except cls._Authorization as auth:
print("✅ Authorization successful!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of this AI slop emojis.


except Exception as e:
print(f"❌ Authentication failed: {e}")
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.exit LMAO????

)

# Auto-enable browser auth if no custom credentials are provided and browser_auth not explicitly set
if (not hasattr(arguments, 'browser_auth') or not arguments.browser_auth) and \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gave me an aneurysm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants