I am a WPF VB.NET Framework 4.8 programmer and I have some trouble requesting Token and TokenSecret with OAuth programmatically. This is my code (I used an online converter to translate this from C#):
Dim OAuthConsumerInformation = New OAuthConsumerInformation("MyConsumerKey", "MyConsumerSecret")
Dim discogsClient = New DiscogsAuthentifierClient(OAuthConsumerInformation)
Dim aouth = discogsClient.Authorize(Function(s) Task.FromResult(GetToken(s))).Result
Dim successString As String = ""
If aouth IsNot Nothing Then successString = "successful." Else successString = "not sucessful."
However, the problem occurs in line 3: My app submits the request, at least my virus scanner shows a message, that my app is trying to connect. But when I hit the button to grant the connection, nothing happens, I could just wait forever...
When I use the provided demo code in C#, everything works fine:
namespace DiscogsAuthenticationConsole
{
public class Program
{
public static void Main(string[] args)
{
var oAuthConsumerInformation = new OAuthConsumerInformation("MeinConsumerKey", "MeinConsumerSecret");
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}, TokenSecret:{aouth?.TokenInformation?.TokenSecret}");
Console.ReadLine();
}
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;
}
}
}
Maybe it's just a translation issue? I can't really figure it out as I am not that familiar with C#...
Hey there :-)
I am a WPF VB.NET Framework 4.8 programmer and I have some trouble requesting Token and TokenSecret with OAuth programmatically. This is my code (I used an online converter to translate this from C#):
However, the problem occurs in line 3: My app submits the request, at least my virus scanner shows a message, that my app is trying to connect. But when I hit the button to grant the connection, nothing happens, I could just wait forever...
When I use the provided demo code in C#, everything works fine:
Maybe it's just a translation issue? I can't really figure it out as I am not that familiar with C#...