How to Authenticate for the first time
DiscogsAuth auth = New DiscogsAuth("UserAgent", "YourConsumerKey", "YourConsumerSecret");
Process.Start(Auth.AuthenticateUser())
String AuthHeaders; //To store the auth headers for this session
This will open a new window of the predefined browser (Opera, Chrome, etc...) and after login and authorization it will give an code to input on your app
AuthHeaders = Auth.AuthorizeApp(pin); //the is the code that's given on the browser
This concludes the authorization code if you don't want the credentials to be stored you just need to close the app and reopen you will see that the session has been destroied
Access the user content after logging in
UserAPI UserInfo = new UserAPI("UserAgent", AuthHeaders)
How to save the Credentials
This step need to be done during the authorization process!
So insert the following code after
AuthHeaders = Auth.AuthorizeApp(pin);
Dictionary<string, string> tokens = Auth.GrabTokens();
My.Settings.Token = tokens("token");
My.Settings.TokenSecret = tokens("token_secret");
My.Settings.Save();
Make sure you have an setting called Token and TokenSecret you can also save this to an ini file or any other method... Remember this will authorize the user to login and they aren't your Token and Consumer keys.
Login with saved credentials
DiscogsAuth Auth = new DiscogsAuth("UserAgent", "ConsumerKey", "ConsumerSecret")
string AuthHeaders = Auth.RegenerateHeaders(My.Settings.Token, My.Settings.TokenSecret)
UserAPI UserInfo = New UserAPI("UserAgent", AuthHeaders)