How to set cookie before redirect response?

May I have an option to set cookie before redirect response? I face an issue that cookie is loaded only after I manually refresh page

  async def render_authenticated_response(
        request: Request, authentication_info: dict[Any, Any], jwt_token: str
    ) -> HTTPResponse:
        """Render response after authentication"""
        response = redirect("/")
        set_cookie(
            response=response,
            domain="127.0.0.1",
            key="jwt_token",
            value=jwt_token,
            httponly=True,
            samesite="strict",
            secure=True,
            expires=authentication_info["expires_at"],
        )
        return response

Can Sanic make something similar to make_response() Flask function to set up cookie before response? Flask example:

@app.route('/')
def index():
    resp = make_response(render_template(...))
    resp.set_cookie('somecookiename', 'I am cookie')
    return resp 

First, certainly it is not an inconvenience for you to ask a question!
Second, you are effectively doing that
You create the response object with redirect and the set a cookie
That is no different.
I’m not sure I understand what you are looking for as an alternative

I think this is the issue they’re experiencing. I’m not sure if that’s normal/expected though.

Worth noting that you are using samesite=strict, which means your browser will only include the cookie when referring from your site
Navigating from anywhere else will not include the cookie.

Thanks a lot, samesite parameter was a root cause of my issue. After I changed it to lax parameter, the application began to work as expected.