web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

MyOB Account Right API and Dynamics CRM

(0) ShareShare
ReportReport
Posted on by 480

Hi everyone,

I am working on Dynamics CRM integeration with MyOB Accounright (Live API) and I am not able to get OAUTH TOKEN from their API.

For each and every request it says "Invalid request" whereas I am sending the message/request in the format given on their developer portal and enclosing all the require headers/parameters.

Can someone help ? I already  got the access code but need to get OAUTH ACCESS TOKEN.

I am using Online/Cloud based file and need to obtain it for the same.

Below is my C# code.

 string baseUrl = "secure.myob.com/.../authorize";
           

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(baseUrl);

                    // We want the response to be JSON.
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                    // Build up the data to POST.
                    List<KeyValuePair<string, string>> postData = new List<KeyValuePair<string, string>>();
                    postData.Add(new KeyValuePair<string, string>("grant_type", "authorization_code"));
                    postData.Add(new KeyValuePair<string, string>("client_id", clientId));
                    postData.Add(new KeyValuePair<string, string>("client_secret", clientSecret));

                    postData.Add(new KeyValuePair<string, string>("scope", "CompanyFile"));
                    postData.Add(new KeyValuePair<string, string>("redirect_uri", "http://desktop"));
                    postData.Add(new KeyValuePair<string, string>("code", "UviY%21IAAAAC64WKiDpPhnUfp48i-WJAmaGrPDe4IhQUKSG90woCudAQEAAAFaYQZmCvVPVUPo4NysgvDzkQR2Xy6Bj2VWNAYlpC_xamLmcPs3Yw9Omw2_6ayPvEapdJYCQhHzRUDoGMrper1JD92jTs7jD1-ywmn6EmLdQnDBSbQGVD_ZN3UqRVtryE1LrDQbKgRF5mhTToqAClH_53qQLiD4enW3cyrmusa1rfx5vmZ5lqVNprUeyv3l6SyhF6b6vNuerqYvqSrLnNbpXSOnT5R9CKTbU5gKPa2Egp7Hm8Uw-4eF2FrEuU3FGXfvTHNpyPhwtzhQzVrNvUR1fzo02c3HRZaN01dfFHoBJucSWYFtT4-S7xm4HG8_TQCOLIPcLeZK-0c65ut7y1V_"));
                    FormUrlEncodedContent content = new FormUrlEncodedContent(postData);

                    // Post to the Server and parse the response.
                    HttpResponseMessage response = await client.PostAsync("authorize", content);
                    string jsonString = await response.Content.ReadAsStringAsync();
                    object responseData = JsonConvert.DeserializeObject(jsonString);

                    // return the Access Token.
                    return ((dynamic)responseData).access_token;
                }
            }

Reference URL (MyOB): 

http://developers.myob.com/api/accountright/api-overview/authentication/


Thanks in Advance.

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans