我正在尝试开发一个简单的应用程序,该应用程序将从 crontab 启动。
此应用程序必须连接到我的 Outlook (Office360) 日历并下载所有事件,之后我将插入到我的 MariaDb 中。
我以为这很容易,但在过去的四天里我失去了理智。
我尝试使用 NodeJs 遵循 Microsoft 文档,但找不到静默模式(一种无需始终登录即可请求身份验证的模式)来接收 token 和数据。
然后我尝试以不同的方式使用Python,首先使用EWS,但我读到它将在未来被弃用,在过去的两天里我正在尝试使用MSAL和ADAL。
MSAL 方法似乎更加分散,但当我使用 acquire_token_by_username_password
或 acquire_token_by_device_flow
启动脚本时仍然遇到此问题
AADSTS7000218:请求正文必须包含以下参数:“client_assertion”或“client_secret”。
我的代码和GitHub的一样https://github.com/AzureAD/microsoft-authentication-library-for-python/tree/dev/sample 我在parameter.json中更改我的配置并插入我的配置:
{
"authority": "https://login.microsoftonline.com/organizations",
"client_id": "ClinetIdOfApp Set in Azure",
"username": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fe93879f9d9d91908abe9f9d9d918b908ad08686" rel="noreferrer noopener nofollow">[email protected]</a>",
"scope": ["User.Read","Calendars.Read"],
"password": "MyPassword*****"
}
拜托,有人可以告诉我一些关于跳这 block 岩石的建议吗? 谢谢
最佳答案
您正在使用资源所有者密码凭据,您需要将您的应用程序视为公共(public)客户端。
登录Azure门户->单击Azure Active Directory->单击应用程序注册->找到您的应用程序->单击身份验证->将默认客户端类型更改为公共(public)客户端。
结果:
关于python - 无法将 MSGraph 与 python MSAL 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56347523/