Jan Nitschke
05/15/2023, 2:12 PM<https://api.airbyte.com/v1/sources/initiateOAuth>
endpoint which will give me a secretId
that I can then use to create the connection. I am hoping that I might only have to go through this once and re-use the secret ID given all ad accounts are authorized via the same facebook account.
However, I am having issues with setting the correct redirect URL, given I am not running any app from which I will be able to accept the response from the flow. Is there a way to redirect my call to something local or to an airbyte hosted page? The docs specify https://cloud.airbyte.io/v1/api/oauth/callback as an example but that doesn't seem to work.Jan Nitschke
05/15/2023, 3:11 PMimport airbyte
from airbyte.models import shared
s = airbyte.Airbyte(
security=shared.Security(
bearer_auth="Bearer xxx",
),
)
req = shared.InitiateOauthRequest(
name="facebook-marketing",
o_auth_input_configuration={
},
redirect_url="<https://cloud.airbyte.io/v1/api/oauth/callback>",
workspace_id="aaaa-bbbb-cccc",
)
res = s.sources.initiate_o_auth(req)
print(res.raw_response.json())
The response is:
{'consentUrl': '<https://www.facebook.com/v12.0/dialog/oauth?client_id=600551260845577&redirect_uri=https%3A%2F%2Fapi.airbyte.com%2Fv1%2Foauth%2Fcallback&state=BmCU1AZ&scope=ads_management%2Cads_read%2Cread_insights%2Cbusiness_management>'}
It's interesting that the redirect_uri
param of the url remains the same no matter my input in the request. Is the client_id specified the client id of the airbyte app?
When clicking on the Link, I get "*URL blocked* This redirect failed because the redirect URI is not white-listed in the app's client OAuth settings. Make sure that the client and web OAuth logins are on and add all your app domains as valid OAuth redirect URIs."Bryce Groff (Airbyte)
05/15/2023, 4:18 PMJan Nitschke
05/15/2023, 7:39 PMJon Tan (Airbyte)
05/15/2023, 7:41 PMJan Nitschke
05/15/2023, 7:45 PMJensen Kuo
08/10/2023, 7:55 PM<https://api.airbyte.com/v1/sources/initiateOAuth>
endpoint so I’m reviving this. As mentioned in the thread, the redirect_url
set in the request does not impact the redirect_uri
in the resulting consent_url
.
As an example, when invoking Notion’s OAuth flow via
curl --request POST \
--url <https://api.airbyte.com/v1/sources/initiateOAuth> \
--header 'accept: application/json' \
--header 'authorization: Bearer <TOKEN>' \
--header 'content-type: application/json' \
--data '
{
"name": "notion",
"redirectUrl": "https://<DOMAIN>.com",
"workspaceId": "<ID>"
}
I get the following response,
{
"consentUrl": "<https://api.notion.com/v1/oauth/authorize?client_id=><ID>&response_type=code&redirect_uri=https%3A%2F%2Fapi.airbyte.com%2Fv1%2Foauth%2Fcallback&state=<STATE>"
}
The link prompts an error (See screenshot).
If I update the redirect_uri
to https%3A%2F%<http://2Fcloud.airbyte.com|2Fcloud.airbyte.com>%2Fauth_flow
, I get the right OAuth flow. So curious to know what I’m doing wrong here.
Thanks for the help!Jon Tan (Airbyte)
08/11/2023, 7:51 PMJensen Kuo
08/15/2023, 3:38 AMJon Tan (Airbyte)
08/16/2023, 12:53 AM