Running this code from the documentation works perfectly in the sandbox, but throws an AuthorizationException when running in production workspace (I have verified that the client is authenticated properly) :
from quickbooks import QuickBooks
from quickbooks.objects import Vendor
# Initialize a QuickBooks client
client = QuickBooks(
auth_client=auth_client,
refresh_token=refresh_token,
company_id=os.getenv("REALM_ID")
)
# Retrieve customers
customers = Customer.all(qb=client)
for customer in customers:
print(customer)
AuthorizationException: QB Auth Exception 401: Application authentication failed
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><IntuitResponse xmlns=\"http://schema.intuit.com/finance/v3\" time=\"2024-11-21T08:19:06.093-08:00\"><Fault type=\"AuthenticationFault\"><Error code=\"130\">Accessing Wrong ClusterWrongClusterError: -11017-You have accessed the wrong server. You will now be redirected. , statusCode: 401"
This code works fine when I authenticate my client object in the sandbox workspace, all good there.
The code throws the above AuthorizationException when I authenticate the client to the production workspace.
I have confirmed that the client authorization is functioning properly by using the same access token to successfully perform a GET request manually to confirm authorization is functioning.
The following code receives a valid response from the server, confirming client authentication in production:
Running this code from the documentation works perfectly in the sandbox, but throws an AuthorizationException when running in production workspace (I have verified that the client is authenticated properly) :
AuthorizationException: QB Auth Exception 401: Application authentication failed <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><IntuitResponse xmlns=\"http://schema.intuit.com/finance/v3\" time=\"2024-11-21T08:19:06.093-08:00\"><Fault type=\"AuthenticationFault\"><Error code=\"130\">Accessing Wrong Cluster WrongClusterError: -11017-You have accessed the wrong server. You will now be redirected. , statusCode: 401 "
This code works fine when I authenticate my client object in the sandbox workspace, all good there.
The code throws the above AuthorizationException when I authenticate the client to the production workspace. I have confirmed that the client authorization is functioning properly by using the same access token to successfully perform a GET request manually to confirm authorization is functioning.
The following code receives a valid response from the server, confirming client authentication in production: