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

Sharepoint On-premise App-Only Authentication fails. #337

Open
janandreschweiger opened this issue Apr 5, 2021 · 5 comments
Open

Sharepoint On-premise App-Only Authentication fails. #337

janandreschweiger opened this issue Apr 5, 2021 · 5 comments
Labels

Comments

@janandreschweiger
Copy link

Hey everyone, I have created a local sharepoint on my computer and would like to use your package. Unfortunately the authentication fails with the following error. Others have mentioned an IndexError for user-authentication, but this error occurs when using app-only authentication and has a totally different traceback.

My sharepoint isn't connected to Azure, thus I use the local ip of my sharepoint-vm as site_url. I have successfully created and granted access as described here .

My team and I really appreciate any help.

Error:

IndexError                                Traceback (most recent call last)
<ipython-input-13-944e8be97f9f> in <module>
      5 site_url = "http://e3431a1d07c8.ngrok.io"
      6 ctx = ClientContext(site_url).with_credentials(ClientCredential('d6e22d2e-4fc6-43e1-920e-7dd7ac5d2fd0','nNCWQ+7Yo5Etyfu14kOvVegPlpy45q1tFe60A+TZSjk='))
----> 7 target_web = ctx.web.get().execute_query()
      8 print(target_web.url)
      9 

...

~/.local/lib/python3.8/site-packages/office365/runtime/auth/providers/acs_token_provider.py in process_realm_response(response)
     80             auth_values = response.headers[header_key].split(",")
     81             bearer = auth_values[0].split("=")
---> 82             return bearer[1].replace('"', '')
     83         return None
     84 

IndexError: list index out of range

Code:

import json
from office365.runtime.auth.client_credential import ClientCredential
from office365.runtime.http.request_options import RequestOptions
from office365.sharepoint.client_context import ClientContext
site_url = "http://192.168.33.2"
ctx = ClientContext(site_url).with_credentials(ClientCredential('client-id','client-secret'))
target_web = ctx.web.get().execute_query()
print(target_web.url)
@ace-kay-law-neo
Copy link

My firm faces the exact same issue. Could you maybe have a look on this one @vgrem? We are really desperate for some help.

@vgrem vgrem added question bug and removed bug labels Apr 5, 2021
@nero-nazok
Copy link

Same here. Thanks @vgrem for having a look.

@vj68
Copy link

vj68 commented Aug 30, 2021

Isn't site_url supposed to be of the form https://abcd.sharepoint.com ?

vgrem added a commit that referenced this issue Nov 10, 2021
@lambrosapoel
Copy link

Hi did you find a solution for this? My sharepoint on premise also doesn't have "sharepoint" in its site_url and I'm receiving IndexError: list index out of range as well . Is there a way to bypass it?

@rv2931
Copy link

rv2931 commented Apr 4, 2024

Hi
Is someone found a solution ? workaround ?
Facing same issue with on premise instance
I have seen that using Client_id/Client_secret could work instead of using user/password.
My problem is that I don't have the permissions to create client_id/secret and it could be complex to obtain so I would to know if it is a real solution or not before "moving mountains"

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

No branches or pull requests

7 participants