Skip to main content

In this article, we will guide you through resolving the "HTTP protocol error. 401 Unauthorized" encountered when connecting to MYOB. This error is typically caused by invalid credentials or authentication issues. Below are various steps and solutions to troubleshoot and resolve the error. 

1. Verify Your User Credentials 

The 401 Unauthorized error can occur if your login credentials are incorrect or if the role associated with your user is not properly configured. 

Check your user role: 

  • If you are an Administrator, use "Administrator" as your username and leave the password blank. After signing in, you will be redirected to the MYOB login page where you will enter your credentials (email and password). 

  • Non-Administrators: Even though the Password field appears mandatory, it's only required if you are not an Administrator and have a different internal role like Bookkeeper or Salesperson. If you are the account Administrator, providing "Administrator" as your username should be sufficient without entering a password. 

  

Important

  • The credentials you use in the connection setup must match the username and password associated with the MYOB company file, not your MYOB Online account credentials. 

  • If no credentials are set for the company file, try using the default "Administrator" account with no password. 

  • Another potential reason for the data visibility issue could be due to the permissions or access rights assigned to the MYOB user. Ensure that the user has the appropriate permissions or scopes required to access the tables or views. Additionally, could you provide screenshots that display the entire error message? Is this issue occurring with specific tables or across all tables? 
     
    Users - MYOB Business - MYOB Help Centre 

 

 

2. Double-Check the CompanyFileId 

One common issue is the absence of the CompanyFileId in the connection configuration. If not specified, the connection driver may pick up the first available company file, which can lead to errors if you are connecting to the wrong file. 

  • Locate your CompanyFileId: The CompanyFileId can be found in the URL of your MYOB account. If you're unsure, use the following SQL query to list all company files: 
    SELECT * FROM CompaniesFiles; 

  • Once you have the correct CompanyFileId, set it in the connection configuration to ensure you're accessing the right company file. 

 

3. Correct Connection Settings  

Make sure that all required fields in the connection settings are properly filled out: 

  • Instance: Set this to Cloud. 

  • AuthScheme: Use OAuth. 

  • InitiateOAuth: Set to GETANDREFRESH. 

  • User: Enter the username associated with the company file. 

  • Password: Use the password of the authorized user (if applicable). 

  

4. MYOB On-Premise Instance Settings 

For on-premise installations of MYOB, the configuration differs slightly: 

  • Instance: Set this to OnPremise. 

  • AuthScheme: Use Basic. 

  • InitiateOAuth: Set to OFF. 

  • URL: Set the URL for the MYOB instance, typically in the format http:// IP Address]:lPort]. 

  

5. Common Issues and Troubleshooting Tips 

  1. Incorrect Username/Password Combination: Ensure you're using the correct MYOB company file credentials. The error commonly occurs when users confuse their MYOB online login with the company file login. The latter is essential for connecting via ODBC or API. 

  1. Permissions/Access Rights: If you're not able to access certain data, check that the user has appropriate permissions or roles to access the required tables or views. You may need to reach out to the Company File Administrator to adjust user permissions. 

  1. Role Confusion: If you have multiple companies, the connection might attempt to access the wrong company file. Confirm that the correct CompanyFileId is specified in your connection settings. 

  1. Administrator Access: If you're still facing issues, try using the Administrator username and leave the password blank, as this user has full access by default. 

  

6. Final Recommendations 

  • Recheck Your Credentials: Make sure the username and password provided in the connection settings are valid and correctly match the user credentials associated with the MYOB company file. 

By following these steps, you should be able to resolve the 401 Unauthorized error and successfully establish a connection to your MYOB instance.