elm-lang / cookie

Would it be better to use the Set-Cookie header?
BSD 3-Clause "New" or "Revised" License
20 stars 5 forks source link

The motivating use case #10

Closed Viir closed 6 years ago

Viir commented 7 years ago

In the case I found, I wanted to know if a user has been using my app the day before. To make this connection between different sessions, I use webbrowser cookies.

I tried the approach of using the Set-Cookie header on an HTTP response. It turned out in that case at least googles chrome browser does not send the cookie with future http requests to the same URL.

Because of this limitation of http cookies, I now use Native code to read and write the cookie.

zwilias commented 6 years ago

@Viir no need for native; the withCredentials flag on Http.request enables exactly this use-case: persistence of information on the client without your app having direct access to it.

Viir commented 6 years ago

@zwilias, thank you, this is very interesting. I will try using withCredentials to make cookies work with HTTP.

Viir commented 6 years ago

Setting the withCredentials flag on the HTTP requests made the browser send the cookies, so I consider this issue solved.