File: auth.nu 4 exported commands 0 internal commands

qb login

Log in to QuickBooks Online and set $env.QUICKBOOKS.

Supports two modes:

  1. Direct token:

qb login --access-token TOKEN --realm-id 12345

  1. Full OAuth2 (will auto-refresh the access token):

qb login --client-id CID --client-secret SEC --refresh-token RT --realm-id 12345

Note: --realm-id is the Realm ID returned in the OAuth callback URL. This is different from your QuickBooks company name or number.

Usage

qb login --access-token <string> --refresh-token <string> --client-id <string> --client-secret <string> --realm-id <string> --minorversion <int> [--sandbox]

Flags

--access-token <string>
OAuth2 access token (direct login)
--refresh-token <string>
OAuth2 refresh token
--client-id <string>
OAuth2 client ID
--client-secret <string>
OAuth2 client secret
--realm-id <string>
Realm ID from OAuth callback (used in API URLs)
--minorversion <int>
QBO API minor version (default: 75)
--sandbox
Use the sandbox API environment

Input/output types

inputoutput
anyany

Examples

login with a direct access token

qb login --access-token "eyJ..." --realm-id "1234567890"

login with OAuth2 credentials (auto-refresh)

qb login --client-id "ABc..." --client-secret "XYz..." --refresh-token "AB1..." --realm-id "1234567890"

login to sandbox environment

qb login --access-token "eyJ..." --realm-id "1234567890" --sandbox

qb logout

Clear the QuickBooks session.

Usage

qb logout

Input/output types

inputoutput
anyany

Examples

log out of QuickBooks

qb logout

qb whoami

Show current QuickBooks session information.

Usage

qb whoami

Input/output types

inputoutput
anyany

Examples

show session info

qb whoami

qb refresh

Refresh the current access token using stored OAuth2 credentials.

Updates $env.QUICKBOOKS with the new token. Requires that you initially logged in with --client-id, --client-secret, and --refresh-token.

Usage

qb refresh

Input/output types

inputoutput
anyany

Examples

refresh your access token

qb refresh