posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Bug(feature flag): 401 error thrown when using `Feature Flags Secure API key` to local evaluate feature flags

Open lshaowei18 opened this issue 8 months ago • 0 comments

Bug Description

This was reported by a community user here.

I haven't tried reproducing in their environment, but the error message seems distinct enough for me to hunt down the code.

I eventually found the error in posthog-python:

https://github.com/PostHog/posthog-python/blob/3778eaef7b62485f9d389135c0261694cb2d832d/posthog/client.py#L840-L844

It seems like an API error, so I started curling in my localhost, following the instruction here

I used the Feature Flags Secure API key as the POSTHOG_PERSONAL_API_KEY, which started to throw error.

How to reproduce

  1. Read the docs here
  2. Write a curl where POSTHOG_PERSONAL_API_KEY is the Feature Flags Secure API key from here
  3. Fire the curl and this should throw an authentication error.

Additional context

Debug info

- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables or https://eu.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]

lshaowei18 avatar Jun 16 '25 00:06 lshaowei18