David-Desmaisons / DiscogsClient

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

Program.cs it doesn't go over #5

Closed Luke1978mi closed 6 years ago

Luke1978mi commented 6 years ago

Hi, Your script:

            var oAuthConsumerInformation = new OAuthConsumerInformation("aaa", "bbb");
            var discogsClient = new DiscogsAuthentifierClient(oAuthConsumerInformation);

            var aouth = discogsClient.Authorize(s => Task.FromResult(GetToken(s))).Result;

            Console.WriteLine($"{((aouth != null)? "Success": "Fail")}");
            Console.WriteLine($"Token:{aouth?.TokenInformation?.Token}, Token:{aouth?.TokenInformation?.TokenSecret}");

Print Fail and exit. I am sure that user key and secret key is correct.

Why this script not respond success? How i can execute some request in discogs DB?

Thank you so much.

David-Desmaisons commented 6 years ago

You should not inform your token here.

Luke1978mi commented 6 years ago

You should not inform your token here.

Modified

David-Desmaisons commented 6 years ago

Well it means that the token you informed is not valid. You have to provide user key + secret key + token

Luke1978mi commented 6 years ago
        private static string GetToken(string url)
        {
            Console.WriteLine("aaaaa");
            Process.Start(url);
            string tokenKey = Console.ReadLine();
            tokenKey = string.IsNullOrEmpty(tokenKey) ? null : tokenKey;
            return tokenKey;
        }

Is here to set token? Where?

David-Desmaisons commented 6 years ago

Console.ReadLine(); You should enter the token in the console. Process.Start(url); opens the browser so that you can identify and get the tpken value.