How Do I Connect My OAuth API to Other Apps on Pipedream Platform?

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

Hey guys, I have an OAuth API in my application and I would like to use Pipedream to connect my application with other connected apps on the pipedream platform. According to the docs, I can either request the integration or use environment variables. But how do I actually connect to my own application using OAuth? The docs aren’t very clear on how to do that. When I go to Connected Accounts, there doesn’t seem to be an option for a custom connected account. cc

You should visit Pricing - Pipedream for the latest pricing, but I’ll do my best to answer. To connect your own application using OAuth with Pipedream, you can follow these steps: 1. Create an OAuth App in Your Application: You need to create an OAuth app in your application and configure the necessary OAuth settings (e.g., redirect URI, client ID, client secret). 2. Use Environment Variables: Since Pipedream does not currently support custom connected accounts directly through the UI, you can use environment variables to manage your OAuth credentials. Here’s how you can do it: - Store OAuth Credentials: Store your OAuth client ID and client secret as environment variables in Pipedream. You can do this by navigating to the Environment Variables section in the Pipedream documentation. - Access OAuth Tokens in Code Steps: In your Pipedream workflow, you can use these environment variables to perform the OAuth flow and obtain access tokens. Here’s an example of how you might do this in a Node.js code step: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ async run({ steps, $ }) { const clientId = process.env.CLIENT_ID; const clientSecret = process.env.CLIENT_SECRET; const redirectUri = “YOUR_REDIRECT_URI”; const authorizationCode = “AUTHORIZATION_CODE_FROM_OAUTH_FLOW”; // Exchange authorization code for access token const response = await axios($, { method: “POST”, url: “https://your-oauth-provider.com/token”, data: { client_id: clientId, client_secret: clientSecret, redirect_uri: redirectUri, code: authorizationCode, grant_type: “authorization_code”, }, }); const accessToken = response.access_token; // Use the access token to make API requests const apiResponse = await axios($, { method: “GET”, url: “https://your-api-endpoint.com/resource”, headers: { Authorization: Bearer ${accessToken}, }, }); return apiResponse; }, });

If you submit that request at pipedream.com/support with any API docs you have, our team can check it out and typically get it integrated asap

Are you trying to publish your app so all Pipedream users can use it? Or just you?

just me, should I still submit a request?

I’m open to other pipedream users using it as well, but mainly just trying to get it working myself

We plan on supporting private apps in the future, but we don’t currently — so if you want Pipedream to manage the OAuth process, then yea, go ahead and submit the info and and team can take a look

got it, I’ll do that thank you!