Repository navigation
docs(setup): name projectToken as the project credential config option - #108
Merged
Merged
Conversation
Five SDKs renamed the project credential configuration option from apiKey to projectToken (posthog-ios #573, posthog-flutter #374, posthog-dotnet #183, posthog-kmp #91, posthog-android #835). The setup spec never named the option, so it did not record which name is canonical, that the old name survives as a deprecated alias, or that the rename stops at the public configuration surface. Adds three requirements to the setup spec: the canonical option name, the deprecated alias and its precedence, and the guarantee that wire fields and persisted storage paths are unchanged. Applies and archives the change on this branch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: 88004f09-5e06-46d4-b82d-ce0799263066
…hipped deprecation Require SDKs that still use apiKey (React Native's PostHogProvider prop, Unity) to add projectToken with a deprecated alias, which needs no major release. Accept compile-time deprecation, since Android, KMP, and Flutter's Dart getter do not log. Scope the both-names precedence scenario to surfaces that accept both, and drop the untestable "before the rename" fixture wording. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
turnipdabeets
marked this pull request as ready for review
October 8, 2026 15:22
dustinbyrne
approved these changes
Oct 8, 2026
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Five SDKs have renamed the configuration option carrying the project credential from
apiKeytoprojectToken, but thesetupspec never named the option at all — it said only "project API key/token". The contract therefore does not record which name is canonical, that the old name survives as a deprecated alias, or that the rename stops at the public configuration surface.Source SDK changes
PostHogConfig(projectToken:), deprecatedapiKeyaliasprojectToken, pluscom.posthog.posthog.PROJECT_TOKENfor native auto-initProjectToken, deprecatedProjectApiKeyaliasprojectToken, deprecatedapiKeyprojectToken, deprecatedapiKeyWhat changed
Three requirements added to
openspec/specs/setup/spec.md:projectTokenis canonical, adapted to platform casing.apiKey, including ones not yet renamed, addsprojectTokenand keeps the old name as a deprecated alias that resolves to the same value. That ships in a minor release; the alias can only be dropped in a later major. A compile-time deprecation counts, and a runtime warning is optional. Where a surface accepts both names at once (options objects, provider props, manifest orInfo.plistkeys),projectTokenwins.api_key,token) and persisted queue/preference paths are unchanged, so stored data survives the upgrade. Positional first-argument constructors were never affected.Narrative updates record which SDKs trim the configured value (iOS, Android, Flutter, React Native), and that React Native's
PostHogProviderapiKeyprop and Unity'sApiKeyhave not adopted the name yet.Proposed, applied, and archived on this branch under
openspec/changes/archive/2026-10-08-rename-api-key-to-project-token/.Not yet renamed
<PostHogProvider apiKey="…">is the named surface to rename. posthog-js #5221 changed only the docs and the missing-token error message. Thenew PostHog(apiKey, options?)constructor and browserinit(token, …)take the token positionally, so they are out of scope.PostHogConfig.ApiKeyandPostHogSettings.ApiKey.Both are non-conforming under this spec until they add
projectTokenwith a deprecated alias. That can ship in a minor release.Uncertainty
apiKeygetter use@Deprecatedonly, so the requirement accepts either, and the alias scenario checks the resolved token, not a log line.@both_token_names_capable.Validation
openspec validate --specs --strictpasses (64 passed, 0 failed), the same as onmain. These are specification checks, not executed SDK conformance tests.Created with PostHog Desktop
🤖 Generated with Claude Code