Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requesting OAuth Token and TokenSecret #27

Open
kafffee opened this issue Jun 5, 2023 · 2 comments
Open

Requesting OAuth Token and TokenSecret #27

kafffee opened this issue Jun 5, 2023 · 2 comments

Comments

@kafffee
Copy link

kafffee commented Jun 5, 2023

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#):

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#...

@kafffee
Copy link
Author

kafffee commented Jun 5, 2023

Thank you in advance for your time.

@kafffee
Copy link
Author

kafffee commented Jun 11, 2023

Problem solved!

I will post results asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant