-
Notifications
You must be signed in to change notification settings - Fork 16
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
Authorize new user #4
Comments
Well, It is very hard to diagnostic anything from what you describe. I would say since |
Sounds like you need to synchronize your UI thread context. |
@FrancisChung DiscogsClent is (and needs to be) agnostic in term of application context (WPF, or WinForm or console, or ASP etc...). So it is the caller responsability to make sure that the API is called on the "context" context. |
I am relatively new to c #. In my WinForm application I used the same code
I found in your console application example:
var oAuthConsumerInformation = new OAuthConsumerInformation("X", "Y");
var discogsClient = new DiscogsAuthentifierClient(oAuthConsumerInformation);
var aouth = discogsClient.Authorize(s =>
Task.FromResult(GetToken(s))).Result;
In the console application the GetToken function is called, instead the
Authorize method seems that never come back in the WinForm App.
I did a debugging session to see what happens inside the Authorize method
and I found that in the RestSharpHelper:
public async Task<OAuthTokenInformation>
GetTokenInformationFromRequest(IRestClient client, string relativeUrl)
{
var request = new RestRequest(relativeUrl, Method.POST);
var response = await client.ExecuteTaskAsync(request);
return !CheckResponse(response) ? null :
GetTokenInformationFromBodyResponse(response);
}
...the ExecuteTaskAsync method never end when executed inside the WinForm
App.
…On Sun, Feb 25, 2018 at 11:18 AM, David Desmaisons ***@***.*** > wrote:
Well, It is very hard to diagnostic anything from what you describe. I
would say since DiscogsAuthenticationConsole is working try to simplify
your code to make it more and more similar to the sample application till
it works.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AiNgcIKj9aJKzradywN3cufd4JdDTo1eks5tYTN4gaJpZM4SSGnh>
.
|
Thank you for your answers and for the suggestions you gave me. I took a look at the stackoverflow link (as FrancisChung suggested) and I think I fall into the "deadlock" case described there by "Daniel". I tried to insert the 'Authorize' procedure in a separate thread and I verified that it works. However, I would like to be able to manage the Key (provided by DiscoGS) and tokens (provided by DiscoGSClient) within my WinForm application, so any suggestions to do this are welcome. |
@David-Desmaisons My comments were meant to be directed at Traponto's code, not yours. Apologies for the miscommunication. And you're absolutely right about APIs needing to be context neutral. |
I'm having trouble activating the authorize procedure inside my WinForm application, it seems that the 'GetToken' function is not invoked and the program goes in loop in the 'Authorize' procedure. I took the same instructions in the sample application 'DiscogsAuthenticationConsole' where instead everything is fine.
The text was updated successfully, but these errors were encountered: