最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Failure to authenticate a SharePoint connection with AuthenticationContext - Stack Overflow

programmeradmin7浏览0评论

I have the following python code in my Matillion PythonScript component:

from office365.sharepoint.client_context import ClientContext
from office365.runtime.auth.authentication_context import AuthenticationContext
authority_url = “/<tenant_id>”

site_url = “”
auth_ctx = AuthenticationContext(authority_url)

if auth_ctx.acquire_token_for_app(client_id, client_secret):
  ctx = ClientContext(site_url, auth_ctx)
  web = ctx.web
  ctx.load(web)
  ctx.execute_query()

  print("Web Title:", web.properties["Title"])
else:
  raise ValueError(“Failed to acquire token for the given client credentials.”)

It errors out at ctx.execute_query() with the following error message

ValueError: {“error”:“invalid_request”,“error_description”:"AADSTS900023: Specified tenant identifier ‘none’ is neither a valid DNS name, nor a valid external domain.

Is there a way to trouble shoot the cause of this error, since the error message is not very informative?

发布评论

评论列表(0)

  1. 暂无评论