Securing ServiceNow Integrations: OAuth, JWT, and API Best Practices
ServiceNow rarely operates in isolation. In most enterprise environments, it integrates with dozens of external systems including cloud platforms, HRIS tools, monitoring solutions, identity providers, and custom applications. Each integration point represents a potential attack surface, and a single misconfigured connection can expose sensitive data or provide unauthorized access to critical systems. Securing these integrations is not optional; it is a fundamental requirement for any organization that takes its security posture seriously.
Why Integration Security Matters
Integrations by their nature involve the exchange of data between systems, often including personally identifiable information, financial records, infrastructure credentials, and business-critical operational data. A compromised integration can lead to data breaches, unauthorized system access, compliance violations, and significant reputational damage. The challenge is compounded by the fact that integrations often use service accounts with elevated privileges, making them high-value targets for attackers. Organizations must treat integration security with the same rigor they apply to user authentication and network security.
OAuth 2.0 in ServiceNow
OAuth 2.0 is the industry standard for authorization, and ServiceNow supports it as both an OAuth provider and an OAuth client. When ServiceNow acts as an OAuth provider, external applications can request access tokens through the authorization code grant or client credentials grant flows without ever handling user passwords directly. When ServiceNow acts as an OAuth client, it can securely authenticate to external APIs using bearer tokens. Best practices for OAuth 2.0 in ServiceNow include:
- Using the client credentials grant for server-to-server integrations where no user context is needed
- Setting short token expiration times and implementing refresh token rotation
- Restricting OAuth client scopes to the minimum permissions required for each integration
- Storing client secrets securely and rotating them on a regular schedule
- Validating redirect URIs strictly to prevent authorization code interception attacks
JWT Token Generation and Validation
JSON Web Tokens (JWT) provide a compact, self-contained mechanism for securely transmitting claims between parties. In ServiceNow, JWTs are commonly used for single sign-on scenarios and API authentication. When generating JWTs, it is critical to use strong signing algorithms such as RS256 (RSA with SHA-256) rather than weaker options like HS256 with shared secrets. The token payload should include standard claims such as issuer (iss), subject (sub), audience (aud), and expiration (exp). On the validation side, ServiceNow should verify the token signature against the issuer's public key, check the expiration timestamp, validate the audience claim matches the expected value, and reject tokens that fail any of these checks. Never skip signature verification, and never trust the algorithm specified in the JWT header without validation against an allowlist.
API Key Management
While OAuth and JWT are preferred for modern integrations, some legacy systems and simpler use cases still rely on API keys. If API keys must be used, they should be treated with the same care as passwords. Store them in ServiceNow's credential store rather than hardcoding them in scripts or properties. Implement key rotation policies that automatically generate new keys and deprecate old ones on a defined schedule. Use API keys in conjunction with IP allowlisting to restrict which systems can use a given key. Monitor API key usage for anomalies such as requests from unexpected IP addresses or unusually high request volumes that could indicate compromise.
Mutual Authentication and SSL
For high-security integrations, one-way SSL is not sufficient. Mutual authentication (mTLS) requires both the client and server to present certificates, ensuring that both parties in the communication are verified. ServiceNow supports mutual authentication for both inbound and outbound integrations. When configuring mTLS, use certificates issued by a trusted certificate authority, implement certificate pinning where possible, and establish automated certificate renewal processes to prevent service disruptions from expired certificates. All integration traffic should be encrypted using TLS 1.2 or higher, and older protocols should be explicitly disabled.
IntegrationHub Security
ServiceNow IntegrationHub provides a centralized framework for building and managing integrations using spokes and flow actions. From a security perspective, IntegrationHub offers several advantages over custom scripted integrations. Credentials are managed centrally through connection aliases, reducing the risk of secrets being scattered across multiple scripts. Flow actions enforce consistent error handling and logging patterns. Spoke configurations can be governed through update sets and application scoping, providing change control and audit trails. When building custom spokes, ensure that credential references use connection and credential aliases rather than hardcoded values, and that all spoke actions validate input parameters to prevent injection attacks.
Monitoring and Auditing Integrations
Security does not end at configuration. Continuous monitoring and auditing are essential for detecting and responding to integration security incidents. ServiceNow provides several mechanisms for integration monitoring:
- Transaction logs that record all inbound and outbound REST and SOAP transactions
- System logs that capture authentication failures, token validation errors, and certificate issues
- Integration dashboards that visualize request volumes, error rates, and response times
- Automated alerts for anomalous patterns such as sudden spikes in failed authentication attempts
- Periodic access reviews that verify integration accounts still require their assigned privileges
Establish a regular cadence for reviewing integration security configurations. As external systems change, as certificates expire, and as new vulnerabilities are discovered, integration security must be continuously assessed and updated. A proactive approach to integration security protects not just your ServiceNow instance but the entire ecosystem of connected systems that depend on it.
Need Help With Your ServiceNow Platform?
Let our certified consultants help you unlock the full potential of the ServiceNow platform.
Contact Us