feat: add SecretKey config, deprecate PersonalApiKey#257
Conversation
Add PostHogOptions.SecretKey, which accepts a Personal API Key or a Project Secret API Key for local flag evaluation and remote config. PersonalApiKey becomes a deprecated alias; SecretKey wins when both set.
posthog-dotnet Compliance ReportDate: 2026-07-07 14:12:33 UTC ✅ All Tests Passed!17/17 tests passed Feature_Flags Tests✅ 17/17 tests passed View Details
|
|
|
Reviews (2): Last reviewed commit: "chore: address Greptile - SecretKey log ..." | Re-trigger Greptile |
|
Marked ready for review. Naming is settled — this is a generic Merge timing still coordinates with the project-secret-key rollout (feature-flagged today) — ready-for-review ≠ merge-now. |
dustinbyrne
left a comment
There was a problem hiding this comment.
examples still contain references to POSTHOG_PERSONAL_API_KEY/personal_api_key
…ey-to-secret-key # Conflicts: # src/PostHog/Config/PostHogOptions.cs
Problem
The credential used for local feature flag evaluation and remote config accepts either a Personal API Key (
phx_...) or a Project Secret API Key (phs_...). The option that carries it is namedPersonalApiKey, which is confusing — it implies only a personal key is valid.Change
Add a new canonical
PostHogOptions.SecretKeyproperty and keepPersonalApiKeyas a deprecated alias. Non-breaking.SecretKeyaccepts a Personal API Key or a Project Secret API Key.PersonalApiKeyis marked[Obsolete("Use SecretKey instead...")](warning, not error).SecretKeywhen non-empty, otherwisePersonalApiKey. When both are set,SecretKeywins. This mirrors the existingProjectToken/ProjectApiKeyalias pattern in this file, so all internal consumers read the canonical property and never touch the obsolete member (no obsolete-warning noise underTreatWarningsAsErrors).<see cref>references updated toSecretKey.PostHog, minor).Context
Coordinated rename across the backend SDKs (Slack discussion). Tracks the rename item in PostHog/posthog-js#4046. Mirrors the draft in posthog-python (#727). This PR covers only the rename item.