Skip to content

Commit 71737b7

Browse files
committed
feat(flags): Pass project API key query string
Updates `remote_config` to pass the project api key in the token query string parameter. This is the same approach used by local_evaluation to ensure routing to the correct project.
1 parent 09dad81 commit 71737b7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

posthog/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1627,6 +1627,7 @@ def get_remote_config_payload(self, key: str):
16271627
try:
16281628
return remote_config(
16291629
self.personal_api_key,
1630+
self.api_key,
16301631
self.host,
16311632
key,
16321633
timeout=self.feature_flags_request_timeout_seconds,

posthog/request.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,16 @@ def flags(
132132

133133

134134
def remote_config(
135-
personal_api_key: str, host: Optional[str] = None, key: str = "", timeout: int = 15
135+
personal_api_key: str,
136+
project_api_key: str,
137+
host: Optional[str] = None,
138+
key: str = "",
139+
timeout: int = 15,
136140
) -> Any:
137141
"""Get remote config flag value from remote_config API endpoint"""
138142
return get(
139143
personal_api_key,
140-
f"/api/projects/@current/feature_flags/{key}/remote_config/",
144+
f"/api/projects/@current/feature_flags/{key}/remote_config?token={project_api_key}",
141145
host,
142146
timeout,
143147
)

0 commit comments

Comments
 (0)