E.Deezer icon indicating copy to clipboard operation
E.Deezer copied to clipboard

OAuth

Open projectgoav opened this issue 10 years ago • 11 comments

Allow in-lib authentication of users.

projectgoav avatar Oct 26 '15 21:10 projectgoav

Try and do this without having to put up a web-page to authenticate users first before getting oauth codes

projectgoav avatar Oct 26 '15 21:10 projectgoav

Hi projectgoav, why not in a first step generate a token via https://developers.deezer.com/api/explorer, and prepare all the APIs to pass the access_token in the query string ? The token generation could be done in parallel, but would not impact the APIs.

xfischer avatar Nov 04 '15 08:11 xfischer

From what I've read and used of the API so far, if you request a token with any permissions other than "offline_access" then the token expires after a certain amount of time. The idea would be that in the background, if the token has expired, the library would request a new one and retry the request.

I'll need to look into a bit more before I commit to anything, but what you've suggested probably the best idea for now.

projectgoav avatar Nov 04 '15 09:11 projectgoav

As of 7b98e5d an access token can be passed in and most user (get) methods will now work, as per @xfischer's suggestion. An updated Nuget package + wiki docs will be out in a couple of days once I've fixed the few remaining bugs.

projectgoav avatar Dec 19 '15 23:12 projectgoav

Hi projectgoav, Did you managed to implement oAuth into your library ? I've seen you've added some "oAuth stuff" into your code but I don't understand what I have to do to get identified. I would like to get the oAuth response accessToken to use it with the new native deezer SDK to play music. Thanks.

Patafoin avatar Apr 08 '16 09:04 Patafoin

@Patafoin - TL;DR - My libary doesn't allow you to obtain access tokens via Deezer's OAuth service. It can only use them, but your application must provide them.

At the time of implementing, there was no way to get an access token from Deezer without using a pop-up webpage, allowing users to accept application permissions. That was outwith the scope of this library, and would add to many dependencies, so this is something you'll have to implement yourself.

I didn't know there was a new native library out, so I will need to have a look at this (thanks for pointing it out!). If it allows you to obtain a token without showing a pop-up up would be something I would certainly like to include in this library.

projectgoav avatar Apr 08 '16 10:04 projectgoav

we can discuss about this in private if you want. I have contacted deezer devs team and they sent me a sample code to adapt native library into a CLI class. The only problem I have now (I've implemented oAuth through an embedded webbrowser) is that it returns me a USER_ACCESS_TOKEN_FAILED response when trying to connect with it... We could work together on this if you want. I've tried to contact you through your "contact" link on your web site but it redirects on your homepage.

Patafoin avatar Apr 08 '16 10:04 Patafoin

I understand you can wrap up native libraries to make them callable in a .NET application. Having a quick look at the docs for the native library I don't see how it is any different from what I have implemented here as you still need to provide an access token you have obtained through some other method but, it does give you the ability to play tracks.

I'm pretty busy the now, but will definately get around to looking at the natvie library in more detail and perhaps incorporate it into this library in the coming months.

projectgoav avatar Apr 08 '16 11:04 projectgoav

It's my main goal :) being able to play songs without using any web plugin or anything else.

Patafoin avatar Apr 08 '16 11:04 Patafoin

If you're wanting to do that, why not just use the Javascript SDK? Then you can have a hidden webview that is the player which you control through your application? Someone else a while back was asking about how to play songs and they suggested that. It's a similar approach to how the Miam-Player allows you to play Deezer songs.

projectgoav avatar Apr 08 '16 12:04 projectgoav

Thanks for your advice. I've already tried to do that but didn't managed to make it work. Currently, the deezer plugin for miam-player isn't available anymore. I've written to the author to know if he will be able to make it available again (he is rewriting it into a new version).

Patafoin avatar Apr 08 '16 13:04 Patafoin