[英]Acquiring OAuth2 access tokens for Exchange Management Shell cmdlets
In our python application, we use the Exchange Management Shell cmdlets to perform some tasks.在我们的 python 应用程序中,我们使用 Exchange 管理 Shell cmdlet 来执行一些任务。 (In fact, the python application runs.Net application, which calls the Exchange Management Shell cmdlets.) Currently we use basic authentication with the New-PSSession cmdlet. (实际上,python 应用程序运行.Net 应用程序,它调用 Exchange 管理 Shell cmdlet。)目前我们使用 New-PSSession cmdlet 进行基本身份验证。 On the other hand, we are already acquiring OAuth2 access tokens for different APIs and resources.另一方面,我们已经为不同的 API 和资源获取了 OAuth2 访问令牌。 Now we would like to use OAuth2 authentication with the Exchange Management Shell cmdlets.现在我们想将 OAuth2 身份验证与 Exchange 管理 Shell cmdlet 一起使用。
We had a look at this article[1].我们看过这篇文章[1]。
However we have a few questions:但是我们有几个问题:
[1] https://developermessaging.azurewebsites.net/2018/09/07/acquiring-oauth2-access-tokens-for-automating-exchange-management-shell-cmdlets/?unapproved=96&moderation-hash=9250fbdda0e11fd8af9bafd4c3576139#review-96 [1] https://developermessaging.azurewebsites.net/2018/09/07/acquiring-oauth2-access-tokens-for-automating-exchange-management-shell-cmdlets/?unapproved=96&moderation-hash=9250fbdda0e351fd8af9#review-d4c 96
Oh, in fact, everything is very simple:哦,其实一切都很简单:
https://login.microsoftonline.com/common/oauth2/authorize?redirect_uri=http%3A%2F%2Flocalhost%3A55555&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&response_type=code
请求授权码: https://login.microsoftonline.com/common/oauth2/authorize?redirect_uri=http%3A%2F%2Flocalhost%3A55555&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&response_type=code
Request for an access token:请求访问令牌:
https://login.microsoftonline.com/common/oauth2/token
URL: https://login.microsoftonline.com/common/oauth2/token
resource=https%3A%2F%2Foutlook.office365.com&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&redirect_uri=http%3A%2F%2Flocalhost%3A9999&code=YOUR_AUTHORIZATION_CODE&client_secret=&grant_type=authorization_code
正文: resource=https%3A%2F%2Foutlook.office365.com&client_id=a0c73c16-a7e3-4564-9a95-2bdf47383716&redirect_uri=http%3A%2F%2Flocalhost%3A9999&code=YOUR_AUTHORIZATION_CODE&client_secret=&grant_type=authorization_code
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.