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

Successful login but still 403? #64

Open
WG- opened this issue Mar 30, 2022 · 2 comments
Open

Successful login but still 403? #64

WG- opened this issue Mar 30, 2022 · 2 comments

Comments

@WG-
Copy link

WG- commented Mar 30, 2022

After successful login via Sharepy I try to fetch two URL's from the SharePoint where the home leads to 403 and the api leads to 200? What is going on here? It seems I am successfully authenticated but still cannot access stuff?

s = sharepy.connect('https://company.sharepoint.com','user@company.com','somepassword')
# Returns no errors or warnings
s.get("https://company.sharepoint.com/")
# results in 403
s.get("https://company.sharepoint.com/_api/")
# results in 200

Furthermore, s.auth.cookie and s.auth.digest have content, i.e., not none.

If I add headers s.get("https://company.sharepoint.com/",headers={'Authorization': f'Bearer {s.auth.digest}'}) it results in 401.

@JonathanHolvey
Copy link
Owner

I think you might be misunderstanding the meaning of the 403 response code. It means that, even if you're authenticated, you aren't allowed to access the resource. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

To resolve this issue you'd probably need to talk to your system administrator to work out why your access is being restricted.

When you changed the authorisation header, the 401 response you got indicated that you probably were authenticated, but not authorised before.

@WG-
Copy link
Author

WG- commented Jun 9, 2022

@JonathanHolvey that is indeed true, and I should have been more complete. In the browser with the credentials used I have no problems to access https://company.sharepoint.com/, but when trying to access it programmatically it results in problems and it is difficult to find out where the problem is. For one I am not sure if sharepy even connects correctly since I do not receive any feedback. Any ideas?

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

No branches or pull requests

2 participants