Forum Discussion

ZamanKhan's avatar
6 years ago

Access code using MYOB Api in c#

I tried but unable to access the code. Please have a look on below code.

private const string CsOAuthServer = "https://secure.myob.com/oauth2/account/authorize/";

private const string CsOAuthScope = "CompanyFile";
try
{
string url1 = string.Format("{0}?client_id={1}&redirect_uri={2}&response_type=code&scope={3}&state={4}", CsOAuthServer,
"sytcvymfdt3xfa9q38XXXXX", HttpUtility.UrlEncode("http://desktop"), CsOAuthScope, "emFtYW4wNzFzZUBnbWFpbC5jb206IUAxMXXXXX");
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(url1);
client.DefaultRequestHeaders.Accept.Add(
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("text/plain"));
HttpResponseMessage response = client.GetAsync("authorize").Result;
var REG = response.Content.ReadAsStringAsync();
}
catch (Exception ex)
{

}
Please see the video if you need more information

 

Reference Link:
https://myobapi.tumblr.com/post/60294451539/passing-state-via-oauth

 

**Editd by MYOB Moderator**

  • Han-Solo's avatar
    Han-Solo
    MYOB Moderator

    Hi ZamanKhan 

     

    Thanks for reaching out, I can see you have emailed us at developers@myob.com. I have replied to your email via developers. 

     

    Please note I have removed the video link from above and edited this post due to sensitive information within this.

     

    Thanks,