bbye98 / minim

A collection of music service (iTunes, Qobuz, Spotify, TIDAL) APIs for media information retrieval and semi-automated music tagging.
https://bbye98.github.io/minim/
GNU General Public License v3.0
41 stars 3 forks source link

Recent changes in the Tidal API? #14

Closed PapaCharlie closed 4 months ago

PapaCharlie commented 4 months ago

Hello, I tried invoking the Tidal Private APIs that your library provides but keep getting 404 or 400 errors. I picked apart the code and invoked the backing APIs directly with curl but got similar results. Do you know if these APIs are still active? Namely I want to modify my favorite tracks

bbye98 commented 4 months ago

What is the exact error message you're getting? The private API works fine for me, even when I'm authenticated but unauthorized.

PapaCharlie commented 4 months ago

Thanks for the response! Here's the API call I'm making:

curl -v -X POST "https://openapi.tidal.com/v1/users/${USER_ID}/favorites/tracks?countryCode=US" \
  -H "Accept: application/vnd.tidal.v1+json" \
  -H "Authorization: Bearer ${TOKEN}" \
  -H "Content-Type: application/vnd.tidal.v1+json" \
  -d '{"trackIds": "354095140", "onArtifactNotFound": "FAIL"}'

And the response is just a 404, nothing interesting:

< HTTP/2 404
< content-length: 0
< date: Wed, 01 May 2024 04:30:43 GMT
< x-envoy-upstream-service-time: 1
< server: envoy
< x-cache: Error from cloudfront
< via: 1.1 a11ff1ad6e4c16fe95e18b435889304a.cloudfront.net (CloudFront)
< x-amz-cf-pop: SFO53-P1
< x-amz-cf-id: tNSp3yIOgj1m08XbALKe2uoMrk8dXlaQdmc7paD2SgmNObgn84IedQ==

Any ideas? I basically translated this bit of code into a curl to test it individually.

PapaCharlie commented 4 months ago

OK wow I figured it out, I was hitting openapi.tidal.com instead of api.tidal.com. I'm getting this error now:

{"status":403,"subStatus":11004,"userMessage":"Token is missing required scope. Required scopes: [READ_USR_DATA] Actual scopes: collection.write collection.read"}

But when I try to ask for a token with the READ_USR_DATA it breaks the login. I'll keep poking around

bbye98 commented 4 months ago

I suggest you authenticate via the device code flow using Minim while specifying all scopes ("r_usr", "w_usr", and "w_sub").

PapaCharlie commented 4 months ago

OK will do, thanks!