Connect an end user
Create a setup link for the customer’s company file.
- Create an end user and save its ID.
- Create an auth session and show authFlowUrl on the QuickBooks computer.
- Verify the connection with a health check after setup.
Still stuck? Contact the app’s support.
Create an end user
Section titled “Create an end user”Create one end user per customer company file, usually when the customer turns on your QuickBooks integration. Set sourceId to your own ID for that customer.
import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";
const client = new DesktopAccountingApi(); // reads DAAPI_SECRET_KEY
const endUser = await client.endUsers.create({ companyName: "Acme Supply", sourceId: "cust_8812", email: "ops@acme.example",});console.log(endUser.id); // eu_01j9...from desktopaccountingapi import DesktopAccountingApi
client = DesktopAccountingApi() # reads DAAPI_SECRET_KEY
end_user = client.end_users.create( company_name="Acme Supply", source_id="cust_8812", email="ops@acme.example",)print(end_user.id) # eu_01j9...using DesktopAccountingApi.QuickBooksDesktop;using DesktopAccountingApi.QuickBooksDesktop.Models;
var client = new DesktopAccountingApiClient(); // reads DAAPI_SECRET_KEY
var endUser = await client.EndUsers.CreateAsync(new EndUserCreateInput{ CompanyName = "Acme Supply", SourceId = "cust_8812", Email = "ops@acme.example",});Console.WriteLine(endUser.Id); // eu_01j9...import com.desktopaccountingapi.quickbooksdesktop.DesktopAccountingApiClient;import com.desktopaccountingapi.quickbooksdesktop.models.EndUser;import com.desktopaccountingapi.quickbooksdesktop.models.EndUserCreateInput;
DesktopAccountingApiClient client = DesktopAccountingApiClient.fromEnv(); // reads DAAPI_SECRET_KEY
EndUser endUser = client.endUsers().create( new EndUserCreateInput("Acme Supply", "cust_8812", "ops@acme.example"));System.out.println(endUser.id()); // eu_01j9...curl https://api.desktopaccountingapi.com/v1/end-users \ -H "Authorization: Bearer $DAAPI_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{"companyName":"Acme Supply","sourceId":"cust_8812","email":"ops@acme.example"}'Save the returned id with your customer record. End users and connections covers the fields and rules.
Create a setup link
Section titled “Create a setup link”import { DesktopAccountingApi } from "@desktopaccountingapi/quickbooks-desktop";
const client = new DesktopAccountingApi();
const session = await client.authSessions.create({ publishableKey: process.env.DAAPI_PUBLISHABLE_KEY ?? "", endUserId: "eu_01j9...", linkExpiryMins: 1440, // one day redirectUrl: "https://app.example.com/settings/quickbooks/done",});// Send the customer to session.authFlowUrlimport osfrom desktopaccountingapi import DesktopAccountingApi
client = DesktopAccountingApi()
session = client.auth_sessions.create( publishable_key=os.environ["DAAPI_PUBLISHABLE_KEY"], end_user_id="eu_01j9...", link_expiry_mins=1440, # one day redirect_url="https://app.example.com/settings/quickbooks/done",)# Send the customer to session.auth_flow_urlusing DesktopAccountingApi.QuickBooksDesktop;using DesktopAccountingApi.QuickBooksDesktop.Models;
var client = new DesktopAccountingApiClient(); // reads DAAPI_SECRET_KEY
var session = await client.AuthSessions.CreateAsync(new AuthSessionCreateInput{ PublishableKey = Environment.GetEnvironmentVariable("DAAPI_PUBLISHABLE_KEY") ?? "", EndUserId = "eu_01j9...", LinkExpiryMins = 1440, // one day RedirectUrl = "https://app.example.com/settings/quickbooks/done",});// Send the customer to session.AuthFlowUrlimport com.desktopaccountingapi.quickbooksdesktop.DesktopAccountingApiClient;import com.desktopaccountingapi.quickbooksdesktop.models.AuthSession;import com.desktopaccountingapi.quickbooksdesktop.models.AuthSessionCreateInput;
DesktopAccountingApiClient client = DesktopAccountingApiClient.fromEnv(); // reads DAAPI_SECRET_KEY
AuthSession session = client.authSessions().create( new AuthSessionCreateInput(System.getenv("DAAPI_PUBLISHABLE_KEY"), "eu_01j9...") .linkExpiryMins(1440) // one day .redirectUrl("https://app.example.com/settings/quickbooks/done"));// Send the customer to session.authFlowUrl()curl https://api.desktopaccountingapi.com/v1/auth-sessions \ -H "Authorization: Bearer $DAAPI_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "publishableKey": "pk_live_...", "endUserId": "eu_01j9...", "linkExpiryMins": 1440, "redirectUrl": "https://app.example.com/settings/quickbooks/done" }'Why this happens
Section titled “Why this happens”The hosted flow configures Web Connector and tests the connection. A completed redirect records setup history; it does not prove the connection is online now.
Treat authFlowUrl and clientSecret as credentials. Never log them. Create links only on an explicit setup action, not during rendering. Expiry is 15 minutes to 7 days; the default is 30 minutes.
Returning customers
Section titled “Returning customers”Use replacement setup to move computers. Use installMode: add to keep existing computers. Moved files keep their connector and reset the stored path. A restored backup may require a new connector.
Completion
Section titled “Completion”Preserve authSessionId and status in the redirect. Handle completed, canceled and expired. Verify server-side with a health check or connection.setup_completed, then read current connection status. An expired auth session cannot be extended.
Embedding
Section titled “Embedding”Use an iframe with download and navigation permissions. Allow frame-src https://connect.desktopaccountingapi.com in your CSP. allow-popups opens help; allow-top-navigation-by-user-activation permits the completion redirect. Brand name, logo and personal-data settings remain in dashboard settings.
Iframe example
Section titled “Iframe example”<iframe src="https://connect.desktopaccountingapi.com/setup/authsess_secret_..." title="Connect QuickBooks Desktop" sandbox="allow-scripts allow-same-origin allow-downloads allow-popups allow-top-navigation-by-user-activation" style="width: 100%; height: 720px; border: 0"></iframe>Completion URL
Section titled “Completion URL”https://app.example.com/settings/quickbooks/done?authSessionId=authsess_01j9...&status=completedPersonal data
Section titled “Personal data”Use the project’s personal-data setting when the app needs payroll access. For an existing connection, follow the personal-data permission steps.