David-Desmaisons / DiscogsClient

Discogs API C# Client
MIT License
41 stars 16 forks source link

Authorize Requests - QueryString / Token Route #14

Closed scgough closed 5 years ago

scgough commented 5 years ago

Hi, I want to use this package to do some server-side API calls on my site. I don't want to authorise users on my site. I'm just having trouble filling in one seeming gap in the docs.

I have my Discogs App Consumer Key and Secret. I will be searching for an artist then retrieving the artist info.

I can see from your documentation that the option I might want to take is the Token Auth route...e.g.

var tokenInformation = new TokenAuthenticationInformation("my-token");
var discogsClient = new DiscogsClient.DiscogsClient(tokenInformation);

What i'm wondering is how I get my-token with only my consumer key and secret?

Alternative: I can see on the discogs dev site that they also offer a QueryString method of authorising requests:

curl "https://api.discogs.com/database/search?q=Nirvana&key=foo123&secret=bar456" (see: https://www.discogs.com/developers#page:authentication,header:authentication-discogs-auth-flow)

Am I right in thinking this isn't an option with this package?

Thanks for any help you can give.

David-Desmaisons commented 5 years ago

Key and secret are for oAuth authentification. In your case, you need a differente token, you will be able to create it here: https://www.discogs.com/settings/developers

blackboxlogic commented 3 years ago

Reading the Docs, it seems like key and secret can be used when developing an application that people don't sign in to (like server side API calls).

DISCOGS AUTH FLOW 
If you do not plan on building an app which others can log into on their behalf, you should use this authentication method as it is much simpler and is still secure. Discogs Auth requires that requests be made over HTTPS, as you are sending your app’s key/secret or token in the request.