-
Notifications
You must be signed in to change notification settings - Fork 16
/
Program.cs
31 lines (27 loc) · 1.07 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using DiscogsClient;
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using RestSharpHelper.OAuth1;
namespace DiscogsAuthenticationConsole
{
public class Program
{
public static void Main(string[] args)
{
var oAuthConsumerInformation = new OAuthConsumerInformation("", "");
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}");
}
private static string GetToken(string url)
{
Console.WriteLine("Please authourize the application and enter the final key in the console");
Process.Start(url);
string tokenKey = Console.ReadLine();
tokenKey = string.IsNullOrEmpty(tokenKey) ? null : tokenKey;
return tokenKey;
}
}
}