Trouble initiating OAuth for a source using Airbyte Python SDK


The user is facing issues with initiating OAuth for a source using the Airbyte Python SDK. They are unsure if the function is correctly developed or if there is an issue with the redirect URL provided.


Hello, everyone :hand:
I am trying to use airbyte Python SDK to initiate OAuth for a source
I’ve set the function based on the documentation of Airbyte github repo

And this what the function looks like

    o_auth_actor = getattr(shared.OAuthActorNames, actor_name, None)
    if o_auth_actor is None:
        raise ValueError(f"Invalid OAuthActorNames key: {actor_name}")
    req = shared.InitiateOauthRequest(

    res = s.sources.initiate_o_auth(req)
    if res.status_code == 200:
        # Parse the JSON response to get the URL
        response_data = res.raw_response.json()
        # Assuming the URL is in the response data under a specific key, e.g., 'oauth_url'
        oauth_url = response_data.get('consentUrl', None)
        if oauth_url:
            return oauth_url
            raise ValueError("OAuth URL not found in the response.")
        # Handle non-200 responses or add additional error handling as needed
        raise ValueError(f"Failed to initiate OAuth. Status code: {res.status_code}")```
The function is returning a url and when accessing it is not working.
I am trying to initiate OAuth for SNAPCHAT_MARKETING as actor_name and I am using cloud airbyte.

When hitting the URL snapchat is returning something went wrong without any additional info.
But trying to create SNAPCHAT source on the cloud airbyte UI it is working.

First I need to verify if the function is correctly developed or I am missing something
Second if I am using the right redirectUrl

What I’ve tried as redirect URL is the following:
• <> got it from the response when initiating OAuth using the cloud UI
• <> got it from <> as set in the examples
Both Failed but I am not sure if it is from the redirect URL or something else

Thank you for your help in advanced!



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here]( if you want to access the original thread.

[Join the conversation on Slack](

["airbyte-python-sdk", "initiate-oauth", "oauth", "source", "redirect-url", "snapchat-marketing"]