capacitor-community / http

Community plugin for native HTTP
MIT License
209 stars 136 forks source link

cookies not being persisted between app runs #205

Open yocontra opened 2 years ago

yocontra commented 2 years ago

Describe the bug Using setCookie with an expires value, cookies do not persist if you close the app.

To Reproduce

Steps to reproduce the behavior:

const SESSION_TIME = 1000 * 60 * 60 * 24 * 30 // 30 days

await Http.setCookie({
  url: API_BASE,
  key: 'platform-session',
  value: sessionToken,
  expires: new Date(Date.now() + SESSION_TIME).toUTCString()
})

Close the app, and re-open and the cookie is gone.

Expected behavior When the app is closed (either force closed, phone restart, etc.) the cookies should persist when the app is launched again. The cookies should only expire when the expires field defines they should.

Smartphone (please complete the following information):