[英]Outlook add-in O365 login flow using javascript
I'm implementing Outlook add-in to my site. 我正在将Outlook加载项实现到我的网站。 I need to implement authenticate Office 365 login functionality.I tried this url to login to office 365 :
我需要实现身份验证Office 365登录功能。我尝试使用此URL登录到Office 365:
https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
When I hit this URL directly from the browser, I'm getting the response as 当我直接从浏览器中访问此URL时,得到的响应为
Array
(
[code] => M26235f9c-3bb8-aa61-14ab-5d8110dc3f1a
)
But the issue is when I try to hit this URL from outlook add-in, it returns an error 但是问题是当我尝试从Outlook加载项中访问此URL时,它返回错误
"Refused to display ' https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default ' in a frame because it set 'X-Frame-Options' to 'deny'. ".
“拒绝显示' https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph。 microsoft.com%2F.default ,因为它会将'X-Frame-Options'设置为'deny'。”。
Why this error occurred and how to fix this. 为什么会发生此错误,以及如何解决此问题。
When I hit this URL from browser: 当我从浏览器中访问此URL时:
https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
I'm getting the result: 我得到结果:
Array
(
[code] => M26235f9c-3bb8-aa61-14ab-5d8110dc3f1a
)
Is that what I'm trying is correct or are there some other ideas to login with O365 in outlook add-in? 这是我所尝试的是正确的还是在Outlook加载项中使用O365登录还有其他想法吗? Can anyone suggest any reference tutorial to implement login with O365 in outlook add-in?
谁能建议任何参考教程来在Outlook加载项中实现O365登录?
As the error suggests , you cannot display this page in an Frame/IFrame/Embed 如错误所示 ,您无法在Frame / IFrame / Embed中显示此页面
"Refused to display ' https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default ' in a frame because it set 'X-Frame-Options' to 'deny'. ".
“拒绝显示' https://login.microsoftonline.com/common/oauth2/authorize?api-version=2.0&client_id=XXX&response_type=code&redirect_uri=https://mysiteurl/auth.php&scope=https%3A%2F%2Fgraph。 microsoft.com%2F.default ,因为它会将'X-Frame-Options'设置为'deny'。”。
You will have to use dialog to handle you authentication flow. 您将必须使用对话框来处理身份验证流程。
How to use the Dialog API in your Office Add-ins 如何在Office加载项中使用Dialog API
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.