Dniel97 / RedSea

Music downloader for Tidal, revived, revived, revived and modded to download Dolby Atmos
141 stars 11 forks source link

TV client_id & client_secret don't work anymore #4

Closed melgu closed 3 years ago

melgu commented 3 years ago

The provided TV client_id & client_secret don't seem to work anymore. I tried to reproduce the issue in isolation. Trying to log in, I get an error 401.

curl -d "client_id=aR7gUaTK1ihpXOEP&client_secret=eVWBEkuL2FCjxgjOkR3yK0RYZEbcrMXRc2l8fU3ZCdE&device_code=9dd91505-b478-4821-a2db-13301a20f30b&grant_type=urn:ietf:params:oauth:grant-type:device_code&scope=r_usr+w_usr+w_sub" -X POST https://auth.tidal.com/v1/oauth2/token

{"status":401,"error":"invalid_client","sub_status":1005,"error_description":"Invalid client credentials"}

If I understand correctly, I should get a 400 status code until I log in using the URL with which I authorize the given device (identified by the device_code).

zpoo32 commented 3 years ago

&client_secret=eVWBEkuL2FCjxgjOkR3yK0RYZEbcrMXRc2l8fU3ZCdE&

Your parameters seem to be missing the %3D or equivalently the = sign at the end of the client secret. Adding that back in, it works perfectly. Also, I noticed that you're using a different scope with WRITE_SUBSCRIPTION enabled so out of curiosity, are you working on a different project and just copy pasted the token incorrectly from in RedSea?

zpoo32 commented 3 years ago

By the way, Tidal just changed tokens for the first time in quite a while (pretty interesting coincidence) so in future this may be reopened once the old ones expire

melgu commented 3 years ago

Hi! Thanks for your quick reply. Indeed, I'm working on a different project (TidalSwift), although my testing wasn't directly related. The old sessionId-based approach, which I used before, stopped working. So I explored, how other projects handle authorization. I originally saw the clientId:clientSecret combo over at Tidal-Media-Downloader, but then saw that you were using the same keys.

melgu commented 3 years ago

For now, TidalSwift just uses the HTTP authorization directly and doesn't offer classic user:pass login.

melgu commented 3 years ago

I came to your project, because I saw that you offer Dolby Atmos streaming, which I wanted to try out.

Dniel97 commented 3 years ago

I originally saw the clientId:clientSecret combo over at Tidal-Media-Downloader, but then saw that you were using the same keys.

Exactly we both used the keys provided by openTidal which got removed after Tidal-Media-Downloader using those.

zpoo32 commented 3 years ago

I came to your project, because I saw that you offer Dolby Atmos streaming, which I wanted to try out.

Sadly it's actually quite difficult to play Dolby Atmos, but it was very fun to play around with

For now, TidalSwift just uses the HTTP authorization directly and doesn't offer classic user:pass login.

Well due to reCaptcha, it's actually pretty difficult getting classic user:pass working again. You can still get reCaptcha working, though it's quite annoying to work with. I personally prefer just using the TV login system

melgu commented 3 years ago

That seems like the best approach for the moment. Am I allowed to use the TV clientId & secret, which you use, in TidalSwift?

zpoo32 commented 3 years ago

Tidal has already replaced it in their apps, so it should be okay to use until it expires

melgu commented 3 years ago

Sadly it's actually quite difficult to play Dolby Atmos, but it was very fun to play around with

I like messing around with mostly undocumented stuff (which is why I started TidalSwift), so I might give it a try.

zpoo32 commented 3 years ago

Yeah I've spent a lot of time looking into different services to the point it's a bit excessive, but some of the stuff I've found was genuinely awesome. Anyways for Dolby Atmos you've got these options to play it: (pretty much only for the DD+ codec not the newer but far lower bitrate AC4 with one exception, Android)

And that's it. If you don't have one of those, you're out of luck. Best way to listen would be with speakers, though I haven't tried it that way.

melgu commented 3 years ago

I already tried Tidal with Dolby Atmos via the Fire TV stick, which works good. But I wanted to inspect the file and - maybe - offer playback in TidalSwift, once macOS gets full Atmos support. Here's hoping after it coming to tvOS and iOS.