Connect ServiceNow to n8n?
You can connect ServiceNow to n8n using OAuth2 by registering an OAuth app in ServiceNow and adding an OAuth2 credential in n8n. This guide gives a short, direct path to get a working integration that can call ServiceNow APIs from an n8n workflow.
What You Need to Connect ServiceNow to n8n
- A ServiceNow admin account with access to System OAuth (Application Registry).
- An n8n instance (Cloud or Docker) and a reachable webhook/redirect URL.
- A browser and basic comfort with copying client ID and secret.
Step 1: Create an OAuth application in ServiceNow
1. In ServiceNow, go to System OAuth > Application Registry. 2. Click “New” and choose “Create an OAuth API endpoint for external clients.” 3. Enter a name. 4. Set the Redirect URL to your n8n callback, for example: https://your-n8n-domain/rest/oauth2-credential/callback. 5. Save and note the Client ID and Client Secret. 6. Optionally set allowed scopes for least privilege.
Step 2: Run n8n (Docker example)
1. Run n8n locally or on a server. 2. Expose it on a domain or use a secure tunnel so ServiceNow can reach the callback URL.
docker run -it --rm -p 5678:5678 \
-e N8N_BASIC_AUTH_ACTIVE=true \
-e N8N_BASIC_AUTH_USER=n8nuser \
-e N8N_BASIC_AUTH_PASSWORD=ChangeMe123 \
-e WEBHOOK_URL=https://your-n8n-domain \
n8nio/n8n:latest
3. If you use n8n Cloud, use the cloud redirect URL provided by n8n in the credential creation step.
Step 3: Add OAuth2 credential in n8n
1. In n8n, open Credentials > New > OAuth2 (generic). 2. Enter the Authorization URL: https://INSTANCE.service-now.com/oauth_auth.do. 3. Enter the Token URL: https://INSTANCE.service-now.com/oauth_token.do. 4. Paste Client ID and Client Secret from ServiceNow. 5. Use the same Redirect URI you registered. 6. Click “Connect” and complete the Authorization Code flow in the browser to grant access.
# Example callback/redirect value (replace domain)
https://your-n8n-domain/rest/oauth2-credential/callback
# Example API test once you have an access token
curl -H "Authorization: Bearer $ACCESS_TOKEN" \
"https://INSTANCE.service-now.com/api/now/table/incident?sysparm_limit=1"
Step 4: Build a simple workflow to test
1. Create a new workflow in n8n. 2. Add an HTTP Request node or a ServiceNow node if available. 3. Select the OAuth2 credential you created. 4. Call a simple endpoint like the incident table to list results. 5. Run the node and confirm you get a 200 response and JSON data.
Update
1. If the redirect changes, update it in ServiceNow Application Registry and in n8n. 2. If tokens expire, use the refresh token flow available in the OAuth2 credential settings. 3. Rotate client secrets in ServiceNow and update credentials in n8n immediately.
Security
- Store Client ID and Client Secret only in n8n credentials. Do not paste them in public logs.
- Use HTTPS and a valid domain for the redirect URL.
- Limit OAuth scopes to only what your workflow needs.
- Rotate secrets regularly and revoke unused application registrations.
Done
After these steps you will have a working OAuth2 connection that lets n8n call ServiceNow APIs. Use the connection in workflows to create, update, and query records automatically.