-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Android - send session cookies #220
Comments
I need to be able to download documents from a "logged in" session on a web server. All is working well on iOS where the Cookies are sent, but it fails on Android. A fix would be much welcome. |
Cookie support is still work in progress, and I think there is still a lot of problems need to be solved. Besides, you can have a look at RNFetchBlob.net, and add cookies manually into headers. |
@wkh237 Cool, thanks. Can't quite get it to work with a specific host, but for now I'll just grab all hosts. |
@zuzuviewer , it's not supported ATM, I'll add this one when I have time. Please have a look #157 |
@zuzuviewer unfortunately I was only able to retrieve the cookies, not send them again. As you say, they are not sent in the request even when added as a header. |
I've done some testing and it seems that |
What I described in my previous post happens due to line I got it all working by deleting said line and using facebooks |
@Jacse Do you have a branch going with that fix? |
@nikolaiwarner I do now: #388 👍 |
@Jacse I am having the same problem as the original person. I need to use credentials: 'include' to pass cookies to the API. Can you provide an example of how to do this with your merged code? |
@MEDLJosh it should work straight out of the box. If you use the regular fetch to get cookies, these cookies should be sent along with your |
@Jacse is there a way to confirm this is happening clientside? cookie received with fetch is attaching fine to my fetch GET requests but not in react-native-fetch-blob it seems... |
From looking at the code, I don't think that cookies are being sent if you use the Download Manager. The download manager sets up it's own request and doesn't make use of the okhttp3 client so that doesn't share the cookie jar. Would it be possible to grab the same-origin cookies from the cookie jar and inject them into the download request with it's addRequestHeader() method? |
any progress? |
@danna88 on what specifically? |
@Jacse Is download with credentials: 'include' working ? do you have work around for this? |
Hi,
I am using RN@0.34, RNFB@0.10.1-beta.3 and node/express.
Below is the code I use to send the uploaded document.
return RNFetchBlob.fetch('POST', nodeUrl, { 'Content-Type' : 'multipart/form-data', }, [{ name : 'file', filename : 'sample.png', data : wrappedURI }])
Session cookies are sent correctly for iOS , but for android, cookies are not being sent and user is getting logged out.
How can I inlcude
credentials: 'include',
with the request ?Any help is greatly appreciated.
Thanks
The text was updated successfully, but these errors were encountered: