Cannot send cookie from phoenix server

I want to send my website a cookie using
Plug.Conn.put_resp_cookie(conn,“token”,token,http_only: true)

but i get this error
(Plug.Conn.NotSentError) a response was neither set nor sent from the connection

Is there anything i have missed?
Thanks! :smiley:

you cannot set a cookie without sending a HTTP response.

1 Like

You can try this one.

|> put_resp_cookie(conn,“token”,token,http_only: true)
|> send_resp(:no_content, "")
1 Like

Closed on request of the original poster…