Forum Discussion
I am coding in Winforms/.NET 4.8 and it works fine but I am also leaning towards removing the .NET SDK
Hi kjm,
The OAuthLogin.cs and OAuthKeyService.cs files I posted are used in my project, which is WinForms and .NET 4.8.
It's been most of 10 years since I looked at how they work, but they have done all that time for both local, network and cloud company files.
It does seem odd that MYOB have not fixed the broken links and given access to these files. I'm sure it would be to their advantage.
There have been times when I wished that I had not used the SDK, but it did save me a lot of time and a steep learning curve initially and it has been working fine for our purposes.
- kjm3 years agoTrusted Cover User
thanks for digging out those files..pretty simple stuff there..just builds a webbrowser on a form and listens to the DocumentTitleChanged event of the webrowser and then extracts the code from the document. Means that the solution has to reference Windows.Forms namespace making it a little less 'transportable' instead of just calling the users default browser.
The OAuthKeyService.cs is a little more interesting as it uses IsolatedStorage to actually write the Token to a json file. This is not the path I am heading down. I would not be storing the token anywhere except memory. Not sure why or what the advantages of peristing the token like this is instead of to memory...is this incase user/system closes and then reopens and the user/system can reuse the tokens stored locally as opposed to having to make another call to oauth server?
Anyway I have built a test harness polling the api getting data every minute and it look like the refresh token call is handeld by the SDK. I decompiled the SDK and had a look at MYOB.AccountRight.SDK.Services.ServiceBase and it looks like it handles the expiry/refresh token. Means I just have to get the token once and leave the SDK to it. Nice. Was expecting to have to handle the refresh part myself- kjm3 years agoTrusted Cover User
the more interesting point is that the SDK uses HttpWebRequest in WebRequestFactory.cs class to make its calls.
Pretty sure MS are phasing out WebRequest and will only use HttpClient...or hasnt it already been deprecated?
make a point for moving away from the SDK to using RestSharp or just straight HttpClientFactory to the API...seems cleaner
Looking for something else?
Search the Community Forum for answers or find your topic and get the conversation started!
Find technical support and help for all MYOB products in our online help centre
Dig into MYOB Academy for free courses, learning paths and live events to help build your business with MYOB.