Sebastião Assunção
09/11/2025, 2:11 PMasync def initiate_connection(self, app_id: str, token: str, scopes: list[str] | None = None, redirect_url: str | None = None) -> str:
url = "https://api.descope.com/v1/outbound/oauth/connect"
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {self.project_id}:{token}"}
payload: dict[str, Any] = {
"appId": app_id,
"options": {
# "redirectUrl": "http://localhost:3000", # TODO: This should be configurable or come from settings
},
}
if scopes:
payload["options"]["scopes"] = scopes
if redirect_url:
payload["options"]["redirectUrl"] = redirect_url
async with httpx.AsyncClient() as client:
response = await client.post(url, headers=headers, json=payload)
if response.status_code != 200:
raise httpx.HTTPStatusError(f"Failed to initiate connection: {response.status_code} {response.text}", request=response.request, response=response)
data = response.json()
return data["url"]
The connection_url that descope provided is:
https://slack.com/oauth/v2/authorize?access_type=offline&client_id=8701576852820.8983993557349&code_challenge=zflXhaO901Oc-UIz1eBl0YN2L3T0xJi3zBFJoA7nK7M&code_challenge_method=S256&prompt=consent&redirect_uri=https%3A%2F%2Fapi.descope.com%2Fv1%2Foutbound%2Foauth%2Fcallback&response_type=code&scope=app_mentions%3Aread+chat%3Awrite&state=os%2F54e38cc918aecba23fa2885afeba26300588610bb0e38e10ae5f6aba64a8cbf8&user_scope=channels%3Ahistory+channels%3Aread+chat%3Awrite+files%3Aread+files%3Awrite+groups%3Ahistory+groups%3Aread+im%3Ahistory+im%3Aread+im%3Awrite+mpim%3Ahistory+mpim%3Aread+mpim%3Awrite+search%3Aread+team%3Aread+users.profile%3Aread+users.profile%3Awrite+users%3Aread+users%3Aread.email
Has there been any change on your side that could explain this behaviour? Would greatly appreciate some help 🙏Meir Wahnon
09/11/2025, 2:11 PMTal Kapitolnik
09/11/2025, 3:08 PMSebastião Assunção
09/11/2025, 3:08 PMTal Aharoni
09/11/2025, 3:37 PMSebastião Assunção
09/11/2025, 3:44 PM