Forum Discussion

DavidK3's avatar
2 months ago

Cannot get Authentication to work on Windows Forms Desktop app

I am struggling to get through Authentication.  Can someone please help me.

I am writing a Window forms desktop application which needs to interface with MYOB (cloud) to create contacts and raise invoices.

 

I cannot get past the Callback.   I am using the Myob AccountRight API SDK.

 

I have been unable for support to show me a working example of such a call back.  I have tried so many combinations.  Here is my code (is VB .net - but C# is also ok) using 

 

Call back is registered appropriately

My code is as follows:

Dim configuration = New ApiConfiguration(clientid, clientsecret, redirecturi)

Dim oauthService = New OAuthService(configuration)

Dim logina As New OAuthLogin

Dim respstring As String = logina.GetAuthorizationCode(configuration)

I get the myob login screen.

I get the 2 factor authentication screen.

Then it transfers control to my callback. What was the callback supposed to do?

My variable “repstring” returns an empty string. I know it is supposed to be the code to be passed to the outhService.GetTokens

 

I have tried saving it with Javascript in the page - but all i get is "java script errors" - even though the callback works in a browser.

 

That is where I am up to now.

 

This is why I asked for an example of the callback html – so I could see what it was supposed to do – so I could do it - in my setting

 

Any assistance will be greatly appreciated.