-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[SPO] HTTP-Only/Secure Cookies #156
Comments
Thanks for reporting this issue. Does it happens on both Android and iOS? |
I only tried on Android for now tbh. Do you want me to setup it on iOS and check if it fails too? |
@Meshz , after some investigation I think this may due to the lack of cookie storage mechanism on Android native implementation. I'll add it and publish a beta release. |
@wkh237 Thanks for your feedback. If u want me to do any tests, I'll be glad to help. :) |
@Meshz , I've added the cookie storage to Android, please try upgrade the package to |
@wkh237 I'll test as soon as I can, problably coming back to you on Monday. Thanks! |
@wkh237 I tried both |
@Meshz , I'm now familiar with SharePoint so I'm not be able to gather enough information for this issue, is there any way I can test it ? I think it'd be helpful, thank you 😄 |
@wkh237 I just sent you all the necessary files on your e-mail ([email protected]). Please let me know if u need any other info! |
@Meshz , thanks for the assistance, that really helps 👍 After some investigations I've spotted that you're using official Fetch for authorization but try to make a request with RNFB.fetch. The problem is, RNFB's network APIs uses its own cookie and cache storage as such cookies are not sent to SharePoint. I suppose you should replace all the methods with RNFB.fetch (you can simply rewrite them or try to use Fetch Replacement). However, after solving the cookie's issue, I still go error message
Not sure if this is caused by our library ? Besides, always keep in mind when using RNFB.fetch you should escape special characters in URL by yourself, our library would not doing this for you. For example, if the request URL contains OData parameters it usually contains characters needs to be escaped
therefore, you should use
|
@wkh237 Thank you for your investigation. I tried before opening this issue to replace all fetch functions with RNFB.fetch as I thought this was the problem but it wasn't working neither. I did it back and now it's perfectly working on Android! I guess the cookies support u added did the job. Is there any downsides using RNFB.fetch everywhere instead of official Fetch API? BTW, the error message u received was a mistype I made: I won't be able to give you a fast feedback for iOS as I'm focusing on Android for now, but as soon as I can try, I'll come back to you. Thanks again for this plugin and your support! 👍 |
Great to hear that 👍 I suppose IOS will also work as expected because I got the same error message (file doest not exists) on IOS. |
@wkh237 Then I guess I can close this issue as it seems to be working on both platform. Thanks! |
@wkh237 Hello, I would like to reopen this issue as I feel there is still a problem with the cookies handling. I may be wrong but I'll expose the case. I need to auth with a service through multiple calls which set cookies and then send them back. I believe your implementation rewrites the cookieStore and thus they are not all sent back. I will expose the flow of the auth with Fiddler analysis (from browser), then the log of the device in the console. Fiddler
Console of device
As we can see, the browser concatenate the cookies received for the same host along requests while RNFetchBlob replaces them and use only the last "Set-Cookie" header when multiple are received in response (or loop through all and replaces them, so we only see the last one). Am I missing something or am I right? If you need any further explanations I'll be glad to help. Thank you for your time and response. |
@wkh237 Hello, maybe this issue could be solved by adding the possibility to set If the redirect to Request2 is not followed, then the Set-Cookie of Response2 will not overwrite the Set-Cookie of Response1 but I'm not sure if that will work. 🙄 |
Closing this issue as it is solved (at least my case) by adding the option |
Hello,
First of all, thank you for this awesome & helpful package.
I got an issue trying to download a file from SharePoint Online. I log into SPO through the "Fetch API" of RN. In the reponse headers of the login method I get 2 cookies that are HTTP-Only & Secure named "rtFa" & "FedAuth". These cookies are automatically set and sent back with every further request.
When I use the Fetch API, I'm able to get data from SPO. However, when I use RNFetchBlob I get "Access denied.". I guess the problem is that the cookies (rtFa & FedAuth) are not passed to the fetch function your plugin and I can't set them as they are HTTP-Only/Secure.
Any ideas how to resolve this issue? Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: