Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(integrations): send Resend OAuth to the correct authorize host (#90890)

Chris Shinee1d19918c7ec
diff --git a/posthog/models/integration/oauth.py b/posthog/models/integration/oauth.py
index 0c60adfdb328..150fd6ccab10 100644
--- a/posthog/models/integration/oauth.py
+++ b/posthog/models/integration/oauth.py
@@ -727,8 +727,13 @@ class OauthIntegration:
# to read the warehouse resources (emails/audiences/contacts/domains/broadcasts).
# The token response carries no account identifier, so id/name are derived from the
# access-token JWT below (see the resend branch in integration_from_oauth_response).
+ # Every OAuth endpoint lives on api.resend.com, including the authorize endpoint that
+ # the user's browser opens. This is what Resend publishes at
+ # https://api.resend.com/.well-known/oauth-authorization-server. The dashboard host
+ # resend.com has no /oauth/authorize route and answers with its own 404 page, so do
+ # not move the authorize URL there to match the address users see in the dashboard.
return OauthConfig(
- authorize_url="https://resend.com/oauth/authorize",
+ authorize_url="https://api.resend.com/oauth/authorize",
token_url="https://api.resend.com/oauth/token",
token_revoke_url="https://api.resend.com/oauth/revoke",
client_id=settings.RESEND_APP_CLIENT_ID,
diff --git a/posthog/models/test/integration/test_oauth.py b/posthog/models/test/integration/test_oauth.py
index a260a3fa2a6f..baea6f207aca 100644
--- a/posthog/models/test/integration/test_oauth.py
+++ b/posthog/models/test/integration/test_oauth.py
@@ -1363,7 +1363,7 @@ def _make_resend_jwt(payload: dict) -> str:
class TestResendIntegrationModel(BaseTest):
def test_oauth_config(self):
config = OauthIntegration.oauth_config_for_kind("resend")
- assert config.authorize_url == "https://resend.com/oauth/authorize"
+ assert config.authorize_url == "https://api.resend.com/oauth/authorize"
assert config.token_url == "https://api.resend.com/oauth/token"
assert config.token_revoke_url == "https://api.resend.com/oauth/revoke"
assert config.client_id == "resend-client-id"