stack icon indicating copy to clipboard operation
stack copied to clipboard

CORS policy problem with StackClientApp initialized with accessToken

Open antoinedelplace opened this issue 6 months ago • 0 comments

I am using Nextjs with static render (no server components). I want to initialize the StackClientApp with an existing token. I do:

const app = new StackClientApp({
        tokenStore: { accessToken, refreshToken},
      });

But it is not working. I have, even though I am not in production mode:

Access to fetch at 'https://api.stack-auth.com/api/v1/users/me' from origin 'http://localhost:3001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Can you help me fix it ?

It works when I do this, but I want to be able to input a saved token :

const app = new StackClientApp({
        tokenStore: "memory",
      });

I use:

  • @stackframe/stack": "^2.8.12

antoinedelplace avatar Jun 27 '25 17:06 antoinedelplace