joeferraro / react-native-cookies

Cookie manager for React Native
MIT License
788 stars 315 forks source link

Better document purpose of this library? #61

Open slorber opened 7 years ago

slorber commented 7 years ago

Hi,

This may seem crazy but I'm not sure to understand why this library should be used.

Is it possible to explain some common usecases?

The first question that comes to mind is weither or not this library can be used for cookie-based auth. Will cookies be automatically sent in every server request if I use fetch(url) for example?

Or is this library just some utility to parse cookies from response, and put them in some storage space?

nolan-m commented 7 years ago

I can tell you why I'm using this library. I'm developing an app which uses cookie-based auth. Using fetch these cookies are automatically set on my requests. This is causing a few problems for me on requests when I do not want to use cookies. Setting credentials: 'omit' is supposed to remove the cookies from the request, but it is not currently working. Other people have had this problem and the work around seems to be using this library.

See https://github.com/facebook/react-native/issues/1274

I also had a problem where if I set a cookie in the fetch header that cookie would just be added to the current cookies. It would not override the cookie with same name. Using this library I saw able to set and override those cookies.