Forum Discussion

smagar's avatar
smagar
Member
3 years ago

401 Unauthorized error

Hi, I am able to access my company file however, I am getting "401 Unatuthorized" when trying to get customer details. I am using MYOB SDK and passing my user credentials and request as below

var credential = new CompanyFileCredentials("{myusername}", "{mypassword}");
var response = await customerService.GetRangeAsync(companyFile, "", credential);

Please note, oauth is working and I can access my company file.

 

Request URI generated by above code as below

"https://arl2.api.myob.com/accountright/{companyID}/Contact/Customer/?"

 

I have tried many different options as well, such as

Username: "" Password: ""

 

Moreover, I can access my file online using app.myob but I can't see in AccountRight desktop app. I can see only Sandbox.

 

Any help will be much appriciated.

Thanks

Shiva

1 Reply

Replies have been turned off for this discussion
  • kjm's avatar
    kjm
    Trusted Cover User
    3 years ago

    lot of info missing here

     

    Are you using online or network? I assume because you refer to oauth you are trying to connect online but it looks like you you ar etring to connect to a network file using username/password

     

    if so you are not access the service correctly. You need to pass the token from the oauth call into the contructor of the service. 

     

    Read the dev doco Authentication (myob.com)

Looking for something else?

Search the Community Forum for answers or find your topic and get the conversation started!

Community home

Learn:

 

Level up your skills using MYOB software.

 

Find help guides and technical solutions for all MYOB products here

Explore video tutorials for our software at the MYOB Academy here

 

Dig into MYOB Academy for free courses, learning paths and live events to help build your business with MYOB.