How to Handle the Redirect URI for OAuth Sign-In Using Python in Pipedream?

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

Hi everyone. I’m trying to add a Python block that will sign into a service using OAuth and send some get requests. But I’m confused about how to handle the redirect URI, where do I get that from for Pipedream?

Hi , which service are you connecting to?

It’s a UK company called Reapit

Thanks, Pipedream handles integrated apps OAuth tokens and refreshes so you don’t need to — you can request the integration at https://pipedream.com/support → Submit a support ticket → Request an integration

Is there a way to do it manually? I think that requesting Pipedream to do it would take a long time

I can assure you it’s usually pretty quick

But you can try asking :
Hi everyone. I’m trying to add a Python block that will sign into a service using OAuth and send some get requests. But I’m confused about how to handle the redirect URI, where do I get that from for Pipedream?

In Pipedream, the OAuth process is handled by the platform itself, so you don’t need to manually handle the redirect URI. However, if you want to manually handle OAuth in a Python code step, you would typically need to set up a server to handle the redirect URI, which is not directly supported in Pipedream workflows. If you’re trying to connect to a service that isn’t currently integrated with Pipedream, you can request an integration at https://pipedream.com/support → Submit a support ticket → Request an integration. This way, Pipedream can handle the OAuth process for you. If you still want to proceed with manual handling, you might need to use a different platform that supports running a server, or use a service that can receive the redirect and forward the code or token to your Pipedream workflow.

I was looking for something that could be ready by Monday. Do you think that’s feasible?

Today is a holiday in the US.
I can’t give an ETA, but if Reapit follows the usual OAuth 2.0 flows, I believe it can get integrated in a couple of days

I’m looking at the Reapit documentation, would Client credentials flow work for you in the meantime?

I think so, would that be supported in Pipedream?

Yes, you can use import requests or any other Pypi packages in a Python code step

Just make sure to keep the original code scaffolding, i.e.:

import requests

def handler(pd: "pipedream"):
    # Reference data from previous steps
    print(pd.steps["trigger"]["context"]["id"])

    response = [requests.post](http://requests.post)() # your config here

    # Return data for use in future steps
    return {"foo": {"test": True}}

You can edit anything under the handler function

Here’s a guide on Python code steps: Python

Ok, that might do for the time being. Thanks for your help Andrew.

I just published a client credentials version of this app integration: https://pipedream.com/apps/reapit-foundations/.

Ideally I’d like to modify the integration to use authorization_code grant type, but this was the faster route to get you unblocked — can you let me know if this works for you in the interim?

Oops I see the error you just encountered — please try again :slightly_smiling_face:

Sorry, a couple more fixes