This topic was automatically generated from Slack. You can find the original thread here.
Hello, I am currently facing some issues with connecting my ServiceTitan account to my Pipedream service. I have double checked that I have entered the right credentials, and I am also able to use that same credentials to make API calls and such. So I believe the issue may not be with the login details but something to do with the connection here? Any assistance with this would be greatly appreciated.
I’m sorry you’re having trouble connecting your ServiceTitan account to Pipedream. Since you’ve already confirmed your credentials work for direct API calls, the issue may be related to how the connection is set up within Pipedream. Here are some troubleshooting steps and key points based on the Pipedream documentation: — ## 1. ServiceTitan OAuth Connection in Pipedream Pipedream uses OAuth to connect to ServiceTitan. When you connect your account, Pipedream expects the following fields: - Client ID - Client Secret - Tenant ID - Environment (e.g., .staging. or . for production) These are used to generate an OAuth access token for API requests. — ## 2. Example of a ServiceTitan API Request in Pipedream Here’s how Pipedream expects to use your credentials in a component: import { axios } from "@pipedream/platform" export default defineComponent({ props: { servicetitan: { type: "app", app: "servicetitan", } }, async run({steps, $}) { return await axios($, { url: `https://api${this.servicetitan.$auth.environment}[servicetitan.io/settings/v2/tenant/${this.servicetitan.$auth.tenant_id}/employees](http://servicetitan.io/settings/v2/tenant/${this.servicetitan.$auth.tenant_id}/employees)`, headers: { Authorization: `Bearer ${this.servicetitan.$auth.oauth_access_token}`, "st-app-key": `${this.servicetitan.$auth.client_id}`, }, }) }, }) — ## 3. Common Issues to Check - OAuth Flow: Make sure you completed the OAuth flow in Pipedream’s UI (not just entering credentials manually). - Correct Environment: The environment field should be set correctly: - For production: leave blank or use . - For staging: use .staging. - Tenant ID: Double-check your tenant ID is correct. - App Key: The st-app-key header must match your client ID. - Token Expiry: If your OAuth token expired, try reconnecting your ServiceTitan account in Pipedream. — ## 4. Next Steps - Try disconnecting and reconnecting your ServiceTitan account in Pipedream. - If you see a specific error message, please share it here for more targeted help. - If the issue persists, please visit Support - Pipedream for more support options. — If you can provide any error messages or screenshots, I can help you further troubleshoot!
Hey I hope all is well? Pi wasn’t too helpful here. Can you check what the issue here with this OAuth2.0 process? We can’t get to a point that we have an Account saved. We enter the correct details. Cheers!
Hey , @U09FQ5LFA75, here’s what I got from our internal error log:
Exception:401 "Access Denied"
Received 401 from the test request:https://api.servicetitan.io/settings/v2/tenant/123456/employees
Decoded error:{"type":"https://tools.ietf.org/html/rfc7231#section-6.5","status":401,"title":"Application key validation failed, check ST-App-Key header value.","traceId":"7b0ece5d-3b52-436b-8652-744451872b31"}
I’m trying to setup a test account on my side to test for end-to-end flow. Though please take a look at the error message to see if it makes sense to you
In the error message, the tenant id there is wrong I believe, as its not 123456. Its something else and I did attempt to use the right one before that but I got the same error message in the pop up. I can try access it again with the right tenant id.