-
Notifications
You must be signed in to change notification settings - Fork 1
Android set support? #1
Comments
Looks like Android API supports it: https://developer.android.com/reference/android/webkit/CookieManager.html#setCookie(java.lang.String,%20java.lang.String) I'll check it out and put up a PR. Would you mind testing it when it is up? @harrydema |
React Native has support for adding cookies; however, the method is private: https://github.com/facebook/react-native/blob/aee88b6843cea63d6aa0b5879ad6ef9da4701846/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java#L127 Will make a PR to core to make the method public and see how that route goes. |
Let me know when it is available, and i will test it. This is the PR on core: Take a look a test failed |
Can't we use this publlic method instead? @safaiyeh |
Yeah that test is a known issue. It fails on every PR. We currently use that with setFromResponse: https://github.com/safaiyeh/react-native-cookie-store/blob/master/android/src/main/java/com/psykar/cookiemanager/CookieManagerModule.java#L40 My issue is that I have to transform the data in a weird way for it to work. I can use it as a temporary implementation. |
So cookie will be in this format:
My initial thought was to create a string builder and make these fields required. Thanks for taking the initiative to seek out an implementation! |
I am not being able to set several cookies for the same url, when ever a set a new cookie on a url, the past values are removed. Would you please help me to figure out this? |
I’ll take a look today 😁 |
I will send a PR |
I am setting 3 cookies:
But when I do a get, and print all the cookies: I get only the last cookie:
|
How can I test if this is woking? If I do a fetch('https://google.com') I can't see the cookies being sent |
After researching a lot, I found out there is a bigger problem behind this: |
If it is an issue with the react native repo, we can migrate out of using their functions and just use CookieManager. I'll have more time today to look into it. Sorry, still at work haha. |
@harrydema I might have figured out a solution, I pushed it to your PR. |
could you please explain to me that what is the difference between |
Summary: react-native-cookie-store wants the ability to set custom cookies on Android. We use ForwardingCookieHandler to mange the cookies. Exposing the `addCookies` method will allow the module to provide the same functionality on Android. safaiyeh/react-native-cookie-store#1 ## Changelog [Android] [Changed] - Expose addCookies method Pull Request resolved: #27512 Test Plan: N/A Differential Revision: D19236309 Pulled By: cpojer fbshipit-source-id: bf1a0730165456c34c5bf432ac370176a881cbcf
The PR I made to React Native, just got merged in today. I'll try out using their API |
@KingAmo they are the same in the sense that they both store cookies. The data format the method accepts is different. |
on pause until change to react native gets released, will work to get cherry picked. |
When it is going to support the set() method for Android?
The text was updated successfully, but these errors were encountered: