进行基本身份验证时进行Python O365身份验证

时间:2019-01-14 22:01:32

标签: python authentication outlook

我有一个脚本(我没有写过),该脚本使用基本身份验证来访问在线邮箱。脚本使用以下代码:

from O365 import Connection

Connection.login(user,password)

脚本最近失败。经过一些研究,我发现了以下错误:

'Basic Authentication for Outlook REST API is no longer supported...'

我在https://aka.ms/BasicAuthDeprecated上找到了一些信息:

Last year, we announced  that on November 2018, we will stop supporting 
Basic Authentication in the Office 365   Outlook REST API v1.0 and this is a 
follow up announcement to reiterate that we will be decommissioning Basic 
Authentication in Outlook REST API v1.0 this month. This means that new or 
existing apps will not be able to use Basic Authentication in v1.0 and Beta 
versions of Outlook REST API starting December 2018.

If you have been using Basic Authentication in Office 365 Outlook REST API 
v1.0/Beta in your app, you should immediately transition to Microsoft Graph- 
based Outlook REST APIs to continue accessing Exchange Online data. 

Web身份验证不是很合适,我不确定在这里需要做什么。看起来需要某种注册/令牌生成。在我的知识库之外。

有人可以提供指导吗?

谢谢。

1 个答案:

答案 0 :(得分:0)

由于不再支持BasicAuth,您将需要使用OAuth进行O365身份验证。

https://pypi.org/project/O365/#authentication详细介绍了Python库与OAuth的集成。