[PR #34] [MERGED] Fix: Specify domain when setting cookies to prevent conflicts #49

Closed
opened 2026-02-27 19:06:38 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Aran404/SpotAPI/pull/34
Author: @ParkJeongseop
Created: 6/28/2025
Status: Merged
Merged: 6/30/2025
Merged by: @Aran404

Base: mainHead: main


📝 Commits (1)

  • 7384a43 Fix: Specify domain when setting cookies to prevent conflicts

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 spotapi/login.py (+1 -1)

📄 Description

Problem

The application was encountering a CookieConflictError when trying to access cookies:

tls_client.cookies.CookieConflictError: There are multiple cookies with name, 'sp_t'

This error occurred because cookies were being set without specifying a domain initially, and later the same cookie name (sp_t) was set with the .spotify.com domain, resulting in duplicate cookies with the same name but different domains.

Solution

Modified the from_cookies method in spotapi/login.py to explicitly specify the domain when setting cookies:

# Before
cfg.client.cookies.set(k, v)

# After  
cfg.client.cookies.set(k, v, domain=".spotify.com", path="/")

Changes

  • Updated line 118 in spotapi/login.py to include explicit domain specification
  • Ensures all cookies are consistently set with the same domain
  • Prevents cookie conflicts when the same cookie name is used

Testing

  • Verified that the CookieConflictError no longer occurs
  • Confirmed that login functionality works as expected
  • Tested cookie restoration from saved sessions

This fix ensures consistent cookie handling and prevents the duplicate cookie name conflicts that were causing authentication failures.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Aran404/SpotAPI/pull/34 **Author:** [@ParkJeongseop](https://github.com/ParkJeongseop) **Created:** 6/28/2025 **Status:** ✅ Merged **Merged:** 6/30/2025 **Merged by:** [@Aran404](https://github.com/Aran404) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`7384a43`](https://github.com/Aran404/SpotAPI/commit/7384a4375cb74f093785498f60a7d39e4e10349d) Fix: Specify domain when setting cookies to prevent conflicts ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `spotapi/login.py` (+1 -1) </details> ### 📄 Description ## Problem The application was encountering a `CookieConflictError` when trying to access cookies: tls_client.cookies.CookieConflictError: There are multiple cookies with name, 'sp_t' This error occurred because cookies were being set without specifying a domain initially, and later the same cookie name (`sp_t`) was set with the `.spotify.com` domain, resulting in duplicate cookies with the same name but different domains. ## Solution Modified the `from_cookies` method in `spotapi/login.py` to explicitly specify the domain when setting cookies: ```python # Before cfg.client.cookies.set(k, v) # After cfg.client.cookies.set(k, v, domain=".spotify.com", path="/") ``` ## Changes - Updated line 118 in `spotapi/login.py` to include explicit domain specification - Ensures all cookies are consistently set with the same domain - Prevents cookie conflicts when the same cookie name is used ## Testing - [x] Verified that the CookieConflictError no longer occurs - [x] Confirmed that login functionality works as expected - [x] Tested cookie restoration from saved sessions This fix ensures consistent cookie handling and prevents the duplicate cookie name conflicts that were causing authentication failures. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 19:06:38 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotAPI#49
No description provided.