The `intuit-oauth` library is the official Python client for working with Intuit APIs, providing OAuth 2.0 and OpenID Connect implementation. It simplifies authorization, token management, and API calls for services like QuickBooks Accounting, Payments, and UserInfo. The current version is 1.2.6, with active development and regular releases addressing new features, bug fixes, and security updates.
pip install intuit-oauthVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate the `AuthClient` and generate an authorization URL for the user to grant permissions. It highlights the use of `Scopes` and the necessary credentials. In a complete application, the authorization code obtained from the redirect would then be used to fetch bearer and refresh tokens.
Upgrade to version 1.2.6 or later.
Ensure you are using `intuit-oauth` version 1.2.5 or higher for Python 3.12 environments.
Always persist the latest `access_token` and `refresh_token` received after any token exchange or refresh operation.
Configure your production `redirect_uri` to use HTTPS in both your Intuit Developer app settings and your application code.
Always verify that you are using the correct Client ID and Client Secret for your intended environment (sandbox or production).
Ensure you are always storing and using the *latest* refresh_token returned by the token endpoint after each successful refresh operation. If exchanging an authorization code, ensure it is used only once and before it expires. If the user has explicitly disconnected the app, they must reauthorize.
Implement robust logic to refresh the access token using the stored refresh token when a 401 error is encountered. If token refreshing also fails (e.g., with 'invalid_grant'), the user needs to re-authorize your application. Verify that the correct realm_id is used and that your app's scopes are properly configured and granted.
Verify your client_id and client_secret against your Intuit Developer account. Ensure they are correctly base64 encoded as 'client_id:client_secret' and included in the 'Authorization: Basic' header of your token exchange requests, or passed as form parameters if your client implementation requires it.
Navigate to your app's 'Keys & OAuth' tab in the Intuit Developer portal and ensure the redirect_uri in your code precisely matches one of the URIs listed there, including the scheme (http/https), host, port (if applicable), and path. Any mismatch, however minor, will cause this error.
Install the library using `pip install intuit-oauth`. If already installed, ensure you are running your script with the correct Python interpreter (e.g., activate your virtual environment if you are using one, or explicitly use `python3 -m pip install intuit-oauth` and `python3 your_script.py`).