Open
Conversation
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.
Add
x-api-keyAuth SupportSummary
apiKeyconfig option to the coreflagon-useralelibrary that sends anx-api-keyHTTP header with log requestsaccessTokenbut never actually sent it to useralesetStoredOptions()validation bug that rejected partial updates (e.g. saving onlyapiKeywould throw becauseallowListwas undefined)Changes
Core library (
flagon-userale)src/types.d.ts— newApiKeytype, added toConfigValueTypesunion andConfiginterfacesrc/configure.ts— newapiKeyproperty on theConfigurationsingletonsrc/getInitialSettings.ts—apiKeyin worker and browser default settings (readsdata-api-keyattribute)src/sendLogs.ts— setsx-api-keyheader in bothsendLogs()andsendOnClose()when configuredBrowser extension (
flagon-userale-ext)src/utils/storage.ts— addedapiKeyandauthModefields toStoredOptions; fixed validation guard on partial updatessrc/options/auth.tsx— auth mode radio selector with conditional OAuth / API Key formssrc/background/messages/config_change.ts— wires the selected auth mode to userale viauserale.options()Tests
test/spec/sendLogs.spec.ts—x-api-keyheader present when set, absent when null, coexists withAuthorizationtest/spec/configure.spec.ts—apiKeysettable viaconfig.update()Test plan
cd products/userale/packages/flagon-userale && pnpm test— all unit tests passcd products/userale && pnpm build— core library and extension build cleanlypnpm lint— no new lint errorsx-api-keyheader appears on log POST requests in the Network tabAuthorization: Bearer <token>header