S.
08/04/2025, 1:45 PMcredentials include
for js clients to the cookies section. it takes some digging on slack to figure out why it doesn't work out of the box
(https://github.com/ktorio/ktor/pull/4793, https://youtrack.jetbrains.com/issue/KTOR-539/Ability-to-use-browser-cookie-storage#focus=Comments-27-4775173.0-0)JP Sugarbroad
08/04/2025, 10:20 PMJP Sugarbroad
08/04/2025, 10:21 PMAleksei Tirman [JB]
08/06/2025, 8:17 AMPedro Lamarão
08/26/2025, 3:31 PMHttpOnly
cookies stored by the browser. The workaround described in various old posts that wrap fetch
do work but forces credentials = true
globally, which is undesirable in my application. After reading PR 4793, I assumed the code below would allow setting credentials
per request; the code compiles, but fails at runtime with a generic "Fail to fetch" error message. Is this the correct way to send cookies with Ktor 3.2.3 for JS apps?
val response = <http://httpClient.post|httpClient.post>("${apiEndpoint}/profile/session") {
fetchOptions {
credentials = true
}
}
Aleksei Tirman [JB]
08/27/2025, 8:42 AMtrue
value is an invalid enum variant for the credentials
property. You can find the list of valid values here.S.
08/27/2025, 9:26 AMhttpOnly = false
request from a js client. any hints what could be the cause?Pedro Lamarão
08/27/2025, 2:49 PMval response = <http://httpClient.post|httpClient.post>("${apiEndpoint}/profile/session") {
fetchOptions {
credentials = RequestCredentials.INCLUDE
}
}