Why is my custom Oauth App ID not working in my app despite correct workflow for registered end-users?

This topic was automatically generated from Slack. You can find the original thread here.

Hello everyone, hello I’m building an app with a custom Oauth and I try to set up the connection link to that app using the Oauth App ID but it does not seem to work, for example here it returns me that the app does not exist.

In the meanwhile my workflow for end-users using that app, that are already registered, still work.

Did you encounter such issues or how have you done it ?

Here is a code sample to give you some information


import requests

def handler(pd: "pipedream"):
  token = f'{pd.inputs["pipedream_connect"]["$auth"]["oauth_access_token"]}'
  authorization = f'Bearer {token}'
  headers = {"Authorization": authorization}
  r = requests.get('https://api.pipedream.com/v1/apps/oa_Z0iyjy', headers=headers)
  # Export the data for use in future steps
  return r.json()

Output
{"$return_value":{"error":"record not found"}}

Thank you for your time!

It sounds like you’re having trouble using a custom OAuth app with Pipedream Connect, specifically when trying to access an app by its OAuth App ID and receiving an “app does not exist” error. Here are some steps and checks to help troubleshoot and resolve this: — ## 1. Double-check the OAuth App ID - Make sure you are using the correct OAuth App ID. - You can find your OAuth App ID by going to your OAuth clients in Pipedream, clicking the arrow next to your client, and copying the App ID. - See the docs on finding your OAuth App ID. — ## 2. Confirm the App Exists in Your Workspace - The error “app does not exist” usually means the App ID is incorrect, or it doesn’t exist in your workspace. - Check that the App ID you’re using matches exactly what is listed in your workspace. — ## 3. Ensure You Have the Right Permissions - The OAuth access token you use must have permission to access the app in your workspace. - Make sure you are using a valid, non-expired access token. — ## 4. Example: Making a Request to the Pipedream Connect API Your code is mostly correct, but ensure you are using the correct App ID and token. Here’s a sample code snippet for reference: ```
import requests def handler(pd: “pipedream”): token = pd.inputs[“pipedream_connect”][“$auth”][“oauth_access_token”] headers = {“Authorization”: f"Bearer {token}“} app_id = “oa_xxxxxxx” # Replace with your actual OAuth App ID url = f"https://api.pipedream.com/v1/apps/{app_id}” r = requests.get(url, headers=headers) return r.json()

I’ve edited the comment

Thank you for providing more details about your issue with connecting to your custom OAuth app via Pipedream Connect and receiving the “record not found” error when querying the app by its OAuth App ID. Based on the Pipedream Connect documentation, here are some key points and troubleshooting steps: — ## Troubleshooting Steps 1. Verify OAuth App ID - Double-check that the App ID (oa_Z0iyjy in your example) is correct and matches exactly what is shown in your Pipedream dashboard. - App IDs are case-sensitive and must be copied without extra spaces or characters. 2. Check Access Token - Ensure you are using a valid, non-expired OAuth access token. - In Pipedream, the access token should be referenced as this.pipedream_connect.$auth.oauth_access_token in Node.js components. 3. API Request Format - Your request should look like this in a Pipedream component: import { axios } from "@pipedream/platform" export default defineComponent({ props: { pipedream_connect: { type: "app", app: "pipedream_connect", } }, async run({steps, $}) { return await axios($, { url: `https://api.pipedream.com/v1/apps/oa_Z0iyjy`, // Replace with your actual App ID headers: { Authorization: `Bearer ${this.pipedream_connect.$auth.oauth_access_token}`, }, }) }, }) 4. App Existence - If you continue to receive {"error":"record not found"}, the App ID may not exist in your workspace or may have been deleted. - Try listing all apps to confirm your app is present: ```
import { axios } from “@pipedream/platform” export default defineComponent({ props: { pipedream_connect: { type: “app”, app: “pipedream_connect”, } }, async run({steps, $}) { return await axios($, { url: https://api.pipedream.com/v1/apps, headers: { Authorization: Bearer ${this.pipedream_connect.$auth.oauth_access_token}, }, }) }, })

Here is the app in the account data of one of the users we use it for, so it must exists, but when I try to query it from the apps api, it does not work

{“id”:“oa_Z0iyjy”,“name_slug”:“shopify”,“name”:“Shopify (OAuth)”,“auth_type”:“oauth”,“description”:“Shopify is a complete commerce platform that lets anyone start, manage, and grow a business. You can use Shopify to build an online store, manage sales, market to customers, and accept payments in digital and physical locations.”,“img_src”:“https://assets.pipedream.net/s.v0/app_X7Lhpm/logo/orig",“custom_fields_json”:"[{"name":"shop_id","label":"Shop ID","description":"If your store’s URL is https://acme-co.myshopify.com/, your shop ID is acme-co","default":null,"optional":null,"enable_extract":null},{"name":"client_id","label":"Client ID","description":"- This app is intended for Shopify merchants who have public Shopify apps and will not work unless you connect using your own OAuth client.\n- Enter this redirect URI in your Shopify app settings: https://api.pipedream.com/connect/oauth/oa_g5KiBG/callback\n- In order to connect with an unlisted Shopify Admin app, use the Shopify app instead of this one ","default":null,"optional":null,"enable_extract":null},{"name":"client_secret","label":"Client Secret","description":null,"default":null,"optional":null,"type":"password"}]”,“categories”:[“Commerce”],“featured_weight”:8700,“connect”:{“allowed_domains”:[“myshopify.com”],“base_proxy_target_url”:“https://{{custom_fields.shop_id}}.myshopify.com”,“proxy_enabled”:true}}

Based on your message, it sounds like you’re having trouble querying the Shopify (OAuth) app via the Pipedream Apps API, even though you see it in a user’s account data. Key points: - The Shopify (OAuth) app does exist on Pipedream. - The app ID is likely shopify (as referenced in your JSON and the docs). - You can find it in the Pipedream UI and use it in workflows. ### Troubleshooting Steps 1. App Exists in Pipedream - The Shopify (OAuth) app is available and documented at Shopify (OAuth) API Integrations - Pipedream. - You can use it in workflows, and it appears in the Apps API. 2. How to Query the App - If you’re using the Apps API and not seeing the app, make sure you’re using the correct app slug: shopify. - Double-check for typos or extra spaces in your API call. 3. Example: Using Shopify (OAuth) in a Component - Here’s a sample Pipedream component that demonstrates how to use the Shopify (OAuth) app: import { axios } from "@pipedream/platform" export default defineComponent({ props: { shopify: { type: "app", app: "shopify", } }, async run({steps, $}) { const data = { "query": `{ shop { id name email } }`, } return await axios($, { method: "post", url: `https://${this.shopify.$auth.shop_id}.[myshopify.com/admin/api/2024-04/graphql.json](http://myshopify.com/admin/api/2024-04/graphql.json)`, headers: { "X-Shopify-Access-Token": `${this.shopify.$auth.oauth_access_token}`, "Content-Type": `application/json`, }, data, }) }, }) 4. If You Still Can’t Query the App - If you’re querying the Apps API directly and not seeing shopify, try: - Refreshing your API token or session. - Confirming your account has access to the app. - Checking for any filters or query params that might exclude the app. 5. Still Stuck? - If you continue to have issues, please visit Support - Pipedream for more support options. — Summary: The Shopify (OAuth) app exists and is available for use in Pipedream. If you’re not seeing it via the Apps API, double-check the app slug and your API query. If you need further help, reach out to Pipedream support.