Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Getting different results when searching a track depending on the authorization method

Getting different results when searching a track depending on the authorization method

When I use OAuth and Client Credentials to query the Spotify API, I get different search results. Specifically, with OAuth, I can't find certain tracks. For instance, when I search for "concorde lady machine," it should return a track with the ID 23Z5gNoNs9jZCAh9ILPbKL, but this track doesn’t appear in the results when using OAuth as authorization. I've checked that the track is available for the user and I can get it using directly the id.

Reply
6 Replies

I've continued experimenting and found that the issue is due to my account. I tried with another account using OAuth, and I get the expected result, the same as when using Client Credentials. I would really appreciate some support, as I've already contacted the support chat, but they can't help me because it’s a developer-related issue, and this is the only path they've suggested—asking here. However, since it’s account-specific, I think I need a different channel to communicate with someone regarding this issue. Thank you.

I've investigated more and I think that this is caused by the "locale" parameter. I've different values in my accounts:
locale=en-US%2Cen%3Bq%3D0.9
locale=en%2Ces-ES%3Bq%3D0.9%2Ces%3Bq%3D0.8%2Caf%3Bq%3D0.7

I've tried to make an http request with this parameter but it doesn't affect the results. I would appreciate if I can review or change this value on my account.

I found a workaround to continue using the search function as expected. I'm working with Spotipy, and the solution involves creating two Spotify clients: one with the main and problematic account for all operations except search, and another for search using client credentials. The only tricky part is managing tokens and cache properly. I developed a custom client credentials authentication manager to bypass cache tokens check.

Hi, thanks for the feedback, I've already tried using the market parameter but it didn't resolve the issue. It's something related to the account or a configuration that user can't change, the same api call with the same parameters for another account returns the expected result and both accounts are in the same region. This "locale" parameter is the only difference I've been able to see between each one.

Hi fullfine_dev!

 

The reason you are getting a different search result between OAuth and Client Credentials is because the former takes into consideration the specific user to personalize the result (unless the user has opted out of personalization).

 

We also do not guarantee that search results will be the same between different users, you should expect the result to vary.

 

As for why you are not getting a specific track when searching for a specific string could be due to track relinking, or how the search algorithm works. We would discourage you from trying to create app logic that depends on a string returning the same track in search every time, for every user, because we make no guarantees of this.

Suggested posts