NetSuite Token-Based Authentication Setup Guide
Every external system that connects to NetSuite—your Shopify integration, Amazon order sync, shipping platform, business intelligence tool, or custom reporting dashboard—needs authentication....
Disclosure: NetSuiteForge may earn a commission through affiliate links in this article. We only recommend solutions we've personally implemented for ecommerce clients. Our editorial process is independent, and our recommendations are based on hands-on experience.
NetSuite Token-Based Authentication Setup Guide
Every external system that connects to NetSuite—your Shopify integration, Amazon order sync, shipping platform, business intelligence tool, or custom reporting dashboard—needs authentication. Token-Based Authentication (TBA) is NetSuite's recommended method for machine-to-machine connections, and getting it right is critical for both security and operational reliability.
I've debugged hundreds of TBA authentication failures for ecommerce brands. The setup process looks straightforward in documentation, but the reality is filled with subtle gotchas: signature calculation errors, role-permission mismatches, token expiration surprises, and the maddening "Invalid login attempt" message that tells you nothing about what went wrong.
This guide provides a complete, step-by-step TBA setup process with specific attention to the errors you'll encounter and how to resolve them.
Key Takeaways
- Token-Based Authentication (TBA) is the recommended method for all integrations connecting to NetSuite's REST and SOAP APIs
- TBA uses OAuth 1.0 signature mechanism—consumer key/secret + token key/secret, signed with HMAC-SHA256
- The most common TBA error is "Invalid login attempt," usually caused by incorrect signature generation, wrong account ID format, or role-permission issues
- Each integration should have its own token pair (not shared across integrations) for security isolation and easier debugging
- Tokens don't expire by default but can be revoked—plan for token management as your integration count grows
What Is Token-Based Authentication and How Does It Work?
TBA vs. Other Authentication Methods
NetSuite supports several authentication methods:
| Method | Use Case | Security Level | Status |
|---|---|---|---|
| User credentials (email/password) | Interactive login | Low for integrations | Not recommended for API |
| Token-Based Authentication (TBA) | Machine-to-machine API | High | Recommended |
| OAuth 2.0 (Client Credentials) | Modern API integrations | High | Available (newer) |
| OAuth 2.0 (Authorization Code) | User-authorized integrations | High | Available |
TBA is the most widely used because it's been available since 2015, has the broadest documentation, and most integration platforms support it. OAuth 2.0 (Client Credentials flow) is newer and simpler but not yet supported by all integration partners.
How TBA Works
TBA uses four credentials to authenticate each API request:
- Consumer Key — Identifies the integration (application)
- Consumer Secret — Proves the integration's identity
- Token ID — Identifies the specific user/role access grant
- Token Secret — Proves the token's authenticity
Each API request includes an OAuth 1.0 signature calculated from these four values plus request-specific data (timestamp, nonce, URL). NetSuite verifies the signature and, if valid, processes the request with the permissions of the associated role.
API Request → [Consumer Key + Token ID + Signature] → NetSuite
↓
NetSuite validates signature using stored secrets
↓
Request processed with the token's role permissions
How Do You Set Up TBA Step by Step?
Step 1: Enable Token-Based Authentication
- Navigate to Setup → Company → Enable Features
- Go to the SuiteCloud tab
- Under "Manage Authentication," check Token-Based Authentication
- Save
Step 2: Create an Integration Record
The integration record represents the application that will connect to NetSuite.
- Navigate to Setup → Integration → Manage Integrations → New
- Enter a meaningful name (e.g., "Shopify Production Connector" or "BI Dashboard")
- Under Authentication:
- Check Token-Based Authentication
- Optionally check OAuth 2.0 if you want both methods available
- Under Token-Based Authentication:
- Leave "State" as "Enabled"
- Save
Critical: After saving, NetSuite displays the Consumer Key and Consumer Secret. Copy both immediately—they're shown only once. If you lose them, you'll need to create a new integration record.
Store these securely (not in email, not in plain text files):
- Use a secrets manager (AWS Secrets Manager, HashiCorp Vault, 1Password)
- Or store in environment variables on your integration server
- Or use your platform's credential storage (Celigo stores credentials securely, for example)
Step 3: Create a Token Role
Create a dedicated role for the integration rather than using an existing role. This follows the principle of least privilege—the integration should only have permissions it needs.
- Navigate to Setup → Users/Roles → Manage Roles → New
- Name the role specifically: "Integration - Shopify Connector"
- Set permissions based on what the integration needs:
For a Shopify ecommerce integration:
| Permission | Level | Why |
|---|---|---|
| Sales Order | Full | Create/update orders |
| Customer | Full | Create/update customers |
| Item Fulfillment | Create | Create fulfillments |
| Invoice | Create | Create invoices |
| Cash Sale | Create | For immediate payment orders |
| Credit Memo | Create | Process refunds |
| Customer Refund | Create | Issue refunds |
| Item | View | Read product data |
| Log in using Access Tokens | Full | Required for TBA |
| User Access Tokens | Full | Required for TBA |
Important permissions often missed:
- "Log in using Access Tokens" — Under Setup → this must be checked or TBA won't work
- "User Access Tokens" — Under Setup → required for the role to use tokens
- Web Services — Under Setup → required for SOAP API access (if using SuiteTalk)
- REST Web Services — Under Setup → required for REST API access
Step 4: Assign the Role to a User
The token needs to be associated with a user account. Create a dedicated integration user or use an existing admin account.
Recommended: Create a dedicated integration user
- Navigate to Setup → Users/Roles → Manage Users → New
- Create a user: "Integration User - Shopify"
- Set a strong password (the integration won't use password login, but it's required)
- Assign the role created in Step 3
- Save
Why a dedicated user? If a team member leaves and their account is disabled, any tokens under their account stop working. A dedicated integration user is never disabled unless intentionally.
Step 5: Create the Access Token
- Navigate to Setup → Users/Roles → Access Tokens → New
- Select the Application (integration record from Step 2)
- Select the User (integration user from Step 4)
- Select the Role (integration role from Step 3)
- Give the token a descriptive name: "Shopify Production Token"
- Save
Critical: NetSuite displays the Token ID and Token Secret. Copy both immediately—shown only once. Store securely alongside the Consumer Key and Consumer Secret.
You now have four credentials:
- Consumer Key
- Consumer Secret
- Token ID
- Token Secret
Plus your Account ID (found at Setup → Company → Company Information — the account number, formatted like "TSTDRV1234567" for sandbox or "1234567" for production).
Step 6: Test the Connection
Test with a simple API call. Using curl with OAuth 1.0 signing:
The exact format depends on your integration platform. Most platforms (Celigo, Boomi, custom code) have a "Test Connection" button that validates the four credentials.
For custom code, the key parameters for the OAuth signature are:
- OAuth Consumer Key
- OAuth Token
- OAuth Signature Method: HMAC-SHA256
- OAuth Timestamp: Unix epoch in seconds
- OAuth Nonce: Unique random string per request
- OAuth Version: 1.0
Base URL format:
https://{ACCOUNT_ID}.suitetalk.api.netsuite.com/services/rest/record/v1/customer
Note: The Account ID in the URL uses a specific format. For production accounts, replace underscores with hyphens: account "1234567_SB1" becomes "1234567-sb1" in the URL.
What Are the Most Common TBA Errors and How Do You Fix Them?
Error: "Invalid login attempt"
This is the most common and least helpful error message. It can mean:
Cause 1: Incorrect Account ID format
- Production accounts: Use the numeric ID (e.g., "1234567")
- Sandbox accounts: Use the format "1234567_SB1"
- In REST URLs, use hyphens instead of underscores: "1234567-sb1"
Cause 2: Role doesn't have TBA permissions
- Verify "Log in using Access Tokens" permission is set on the role
- Verify "User Access Tokens" permission is set on the role
Cause 3: Signature calculation error
- Verify you're using HMAC-SHA256 (not HMAC-SHA1, which is deprecated)
- Verify the base string includes all OAuth parameters in alphabetical order
- Verify URL encoding is applied correctly (RFC 3986)
- Verify the timestamp is current (within 5 minutes of NetSuite's server time)
Cause 4: Token has been revoked or the integration is disabled
- Check the integration record is still active
- Check the token hasn't been revoked
- Check the user account isn't disabled or locked
Cause 5: IP address restriction
- Some NetSuite accounts have IP address restrictions on integrations
- Verify your integration server's IP is in the allowed list
Error: "Invalid signature"
The OAuth signature doesn't match what NetSuite calculated. This is almost always a code issue:
- Base string construction: The base string must be:
HTTP_METHOD&URL_ENCODED_BASE_URL&URL_ENCODED_PARAMS - Parameter ordering: All OAuth parameters must be sorted alphabetically
- Double encoding: URL-encode the parameter string, then URL-encode the entire base string
- Signing key: The key is
CONSUMER_SECRET&TOKEN_SECRET(both URL-encoded, joined with &)
Error: "Token has been revoked"
The access token was explicitly revoked by an administrator.
Fix: Create a new token pair (Step 5 above) and update the integration's credentials.
Prevention: When revoking tokens, check what integrations are using them first. Maintain a token inventory document that maps tokens to integrations.
Error: "Role required for access"
The user associated with the token doesn't have the selected role, or the role has been deleted/modified.
Fix: Verify the user still has the integration role assigned. Reassign if necessary.
Error: "Concurrency limit exceeded"
Too many simultaneous API requests from the same token.
Fix:
- Implement request throttling (respect NetSuite's concurrency limits)
- Spread requests across time rather than sending bursts
- For high-volume operations, use SuiteScript (runs server-side) instead of external API calls
How Do You Manage Tokens at Scale?
Token Inventory Management
As your integration count grows, token management becomes important:
| Integration | Consumer Key (last 4) | Token (last 4) | User | Role | Created | Last Used |
|---|---|---|---|---|---|---|
| Shopify Connector | ...a7b2 | ...c3d4 | int-shopify | Int-Shopify | 2025-01-15 | Daily |
| Amazon Sync | ...e5f6 | ...g7h8 | int-amazon | Int-Amazon | 2025-02-01 | Daily |
| BI Dashboard | ...i9j0 | ...k1l2 | int-reporting | Int-ReadOnly | 2025-03-01 | Hourly |
Token Security Best Practices
- One token per integration: Never share tokens across multiple integrations
- Dedicated users per integration: Don't use personal accounts for integration tokens
- Least privilege roles: Each integration role should only have the permissions it needs
- Regular token rotation: Rotate tokens every 6-12 months (revoke old, create new)
- Monitor token usage: Check the login audit trail for unexpected API calls
- Immediate revocation: When an integration is decommissioned, revoke its tokens immediately
Token Rotation Process
- Create a new token for the integration (don't revoke the old one yet)
- Update the integration's configuration with the new token credentials
- Verify the integration works with the new token
- Revoke the old token
- Update your token inventory document
Why not revoke first? Revoking the old token before the new one is active causes a service outage. Always create the new token, verify it works, then revoke the old one.
How Does TBA Compare to OAuth 2.0 Client Credentials?
NetSuite now supports OAuth 2.0 Client Credentials flow, which is simpler than TBA:
| Aspect | TBA (OAuth 1.0) | OAuth 2.0 Client Credentials |
|---|---|---|
| Signature required | Yes (HMAC-SHA256 per request) | No (bearer token) |
| Token expiration | Never (until revoked) | Access token expires (short-lived) |
| Setup complexity | Higher (4 credentials, signature code) | Lower (client ID/secret, token endpoint) |
| Platform support | Universal (all integration tools) | Growing (not all tools support it yet) |
| Security model | Each request signed individually | Bearer token with expiration |
Recommendation: Use OAuth 2.0 Client Credentials for new integrations if your integration platform supports it. Use TBA for platforms that don't yet support OAuth 2.0 or for existing integrations that would be costly to migrate.
Frequently Asked Questions
Do TBA tokens expire?
No. TBA tokens don't expire automatically. They remain valid until explicitly revoked by an administrator. This is both a convenience (no token refresh logic needed) and a security consideration (orphaned tokens remain active indefinitely).
Can I use the same token for sandbox and production?
No. Tokens are specific to each NetSuite account (environment). Your sandbox has different integration records, users, and tokens than production. You need separate tokens for each environment.
How many tokens can I create?
There's no practical limit on the number of tokens. You can have multiple tokens per integration, per user, and per role. However, each token-integration-user-role combination must be unique.
What happens if I delete the integration record?
All tokens associated with that integration are automatically revoked. Any integrations using those tokens will immediately fail to authenticate. Be very careful when deleting integration records.
Can I see which API calls a token is making?
Yes. Navigate to Setup → Users/Roles → Login Audit Trail and filter by the integration user. This shows all API calls made with that user's tokens, including timestamps, IP addresses, and the operations performed.
Should I use TBA for SuiteScript (internal scripts)?
No. SuiteScript running within NetSuite (User Event, Scheduled, Map/Reduce scripts) uses the current user's session—no TBA needed. TBA is only for external systems calling NetSuite's API from outside.
Ready to Secure Your NetSuite Integrations?
Token-Based Authentication is the foundation of every NetSuite integration. Getting it right from the start—dedicated users, least-privilege roles, proper token management—saves hours of debugging and reduces security risk.
If your current integrations are running on shared tokens, personal user accounts, or over-permissioned roles, take time to restructure. The investment in proper TBA setup pays for itself in fewer authentication failures and stronger security.
Take our free NetSuite readiness assessment → to evaluate your current integration authentication setup and get a security improvement plan for your NetSuite API connections.
Related Articles
Fixing NetSuite Performance: Why Your Account is Slow
Your NetSuite account is slow. Pages take 8 seconds to load. Saved searches time out. Running a financial report during business hours brings the system to a crawl. Your team is frustrated,...
NetSuite PDF/HTML Template Customization Guide
Every invoice, packing slip, and purchase order that leaves your NetSuite account is a representation of your brand. The default templates look generic at best and unprofessional at worst—plain text,...
NetSuite Release Management: Preparing for Updates
Prepare for NetSuite's semi-annual releases without breaking your system. Impact assessment checklist, sandbox testing protocol, and post-release monitoring.