Next.js Discord

Discord Forum

set cookies from flask login

Unanswered
Pteromalid wasp posted this in #help-forum
Open in Discord
Pteromalid waspOP
hello, i have a flask rest api server in the /api folder on the same lvl as the /src folder. in it i'm using flask_login and a usermixin class to log a user in, create a session, and set a cookie. i have a login function in a server action that calls the flask rest server. i can not set a cookie this way as i've learned.

i have 2 workarounds
1. return the session token from flask to the server action function and set the cookie in there
2. call the flask server from a client component which will allow the flask server to set the cookie itself

either way, i can not call a protected route from a server action even when including credentials: true

what am i doing wrong? hwo do i fix this?

thanks

0 Replies