Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Able to Connect with only one account #183

Open
Soknath opened this issue Dec 10, 2019 · 6 comments
Open

Able to Connect with only one account #183

Soknath opened this issue Dec 10, 2019 · 6 comments

Comments

@Soknath
Copy link

Soknath commented Dec 10, 2019

I have successfully connect to WebDav with the following url: http://example.com/nextcloud/dav/files/USERNAME

This is totally working fine. However, the problem happened when I change USERNAME to different account. it returns 403 error in the request.

Please help me, where I did wrong?

@Soknath Soknath changed the title Able to Connect with only on account Able to Connect with only one account Dec 10, 2019
@perry-mitchell
Copy link
Owner

I take it you're using this in the browser? I presume it's a cookie thing.. I've seen the same issue with ownCloud (upstream of nextcloud).

It's most likely not something you've done wrong, but something the server is doing wrong. In my opinion it should not be creating a session for such connection attempts - these are authenticated restful requests, and shouldn't be tied to an account - this is most likely what's causing the 403. The server probably sees you as already having been logged in to an account.

@perry-mitchell
Copy link
Owner

@Soknath what happens if, in the same browser, you browse to your nextcloud instance after running your code using the initial USERNAME - are you logged in?

If you log out through the UI, run the code again, and then browse back to nextcloud - are you then logged in?

@Soknath
Copy link
Author

Soknath commented Dec 18, 2019

@perry-mitchell thanks for the reply. currently, I am using webdav-client in react-native project. I noticed that only the first connection is fine while switching to diffrent will return in 403. I agree with you that this might be an authentication problem on Nextclound side.

I did check apache log, no useful clue on error besides MKCOL protocol return 403.

@perry-mitchell
Copy link
Owner

@Soknath Well, I'm quick to blame Nextcloud/ownCloud on this one, as they could handle it better, but I do think the browser-side of React-Native is also to blame. It's perhaps something I could try to tackle from this library:

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Sending_a_request_with_credentials_included

That link is for fetch, which this library doesn't use, but I'm sure there's a way to forcibly omit credentials so that the browser isn't attempting to send an open session to the webdav server. This might prevent the aceess issue you're seeing.

@perry-mitchell
Copy link
Owner

@Soknath I think using withCredentials: false for Axios (in this library) could possibly help. You could try doing something like the following:

client.createDirectory("/test/dir", { withCredentials: false });

Or the equivalent method you were using. If you could try that with all requests and see if it fails for the other username, that'd be an immense help!

@perry-mitchell
Copy link
Owner

@Soknath Have you by any chance been able to test my suggestion? This is a tough one to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants