statsig-io / react-sdk

An SDK for using Statsig Feature Management and Experimentation platform in React js clients
ISC License
6 stars 6 forks source link

Getting "Unauthorized" when I using statsig-react #12

Closed keinander closed 1 year ago

keinander commented 1 year ago

Hello! I'm trying to setup Statsig for my react app but unfortunately ran into some troubles right away.

I use statsig-react version 1.30.1.

When I try to initialise the SDK I get the error POST https://events.statsigapi.net/v1/rgstr 401 with the response {"code":401,"reason":"Unauthorized"}

I've even stripped away other parts of my app to a very simple setup:

   <StatsigProvider
      sdkKey="MY_SDK_API_KEY"
      waitForInitialization={true}  
    >
      <div className="App"><h3>hello</h3></div>
    </StatsigProvider>

So obviously I must have the wrong key right? Well, I only find one key with word "SDK" in it so I used that one. I triple checked I add it correctly with the full information. I'll attach a screenshot of where I copied my key from

Screenshot 2023-08-12 at 12 32 25

So I'm kinda out if ideas would really appreciate some help!

daniel-statsig commented 1 year ago

Hey there @keinander. Sorry for the late reply, and sorry that this didn't work.

Looking at in from my side, it does indeed look like something is wrong with this key. I am following up internally. In the mean time, are you able to create a new Client API key and try that?

tore-statsig commented 1 year ago

There was an issue on our backend impacting SDK key propagation, which is now resolved. Please try again. Sorry for the inconvenience