Skip to content
This repository was archived by the owner on Jan 24, 2020. It is now read-only.

Conversation

echo8795
Copy link

adding the set cookie method for android by using react-native's ForwardingCookieHandler class

@caojianfeng
Copy link

caojianfeng commented Dec 24, 2018

@joeferraro Please merge this pull request, if it has no problem.
I need the 'set' method too.

@almirfilho
Copy link

@joeferraro Please bump!

@wangghon
Copy link

@echo8795 , Thanks for the PR. I tried to use your master branch, the same code works well with react-native-webview on iOS when sharedCookiesEnabled is true.The cookie was accepted by login server, the login process bypassed.

However it still needs login on Android, do you have any knowledge about it?

Thanks again


private void setCookie( String url, String value ) throws URISyntaxException, IOException {
URI uri = new URI(url);
Map<String, List<String>> cookieMap = new HashMap<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Map cookieMap = new HashMap<String, List<String>>(); is better looks like than that.

@wangghon
Copy link

After the comments, I compared the cookie content to the one on iOS, they were different, then I found the issue of RN can only pass one cookie on Android.

After I apply the work around (https://facebook.github.io/react-native/docs/network.html#known-issues-with-fetch-and-cookie-based-authentication), unfortunately the login page still can't bypass

@safaiyeh
Copy link

I have forked the repo here: https://github.com/safaiyeh/react-native-cookie-store
We can create issues and PRs there to continue the development of the project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants