我正在尝试在本机 Outlook 客户端中使用 DialogueAsync API 连接 Google Oauth。
Outlook client version details :
Version : 16.13(180513)
Mac OS
当我使用 AsyncAPI 打开 URL 时,它会引发错误。如果我对子窗口做同样的事情,它就会成功打开。
子窗口方法是在 Windows Outlook 客户端中调用弹出窗口阻止程序。所以它无法通过应用程序提交。
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test App</title>
</head>
<body>
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"> </script>
<script type="text/javascript" src="https://d3qov000jfn2nk.cloudfront.net/webaddin/js/core-2.4.1.min.js"></script>
<script type="text/javascript" src="https://d3qov000jfn2nk.cloudfront.net/office-bf.js"></script>
<script>
function dialogueOauth() {
document.getElementById("demo").innerHTML = "Opened dialogue API OAuth window";
Office.context.ui.displayDialogAsync("https://accounts.google.com/o/oauth2/v2/auth?response_type=code&access_type=offline&display=popup&prompt=consent&include_granted_scopes=true&client_id=68597033215-jbnt69ru2e2k23mja1a5oumjrtvhon77.apps.googleusercontent.com&redirect_uri=https://sf.xenovusapps.net/auth/google/callback&scope=https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/userinfo.email");
}
function childWindowOauth() {
document.getElementById("demo").innerHTML = "Opened child window OAuth";
window.open("https://accounts.google.com/o/oauth2/v2/auth?response_type=code&access_type=offline&display=popup&prompt=consent&include_granted_scopes=true&client_id=68597033215-jbnt69ru2e2k23mja1a5oumjrtvhon77.apps.googleusercontent.com&redirect_uri=https://sf.xenovusapps.net/auth/google/callback&scope=https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/userinfo.email");
}
</script>
<button onclick="dialogueOauth()">connect oAuth with DialogueAPI</button>
<br/><br/><br/>
<button onclick="childWindowOauth()">connect oAuth with ChildWindow</button>
<p id="demo"></p>
</body>
</html>
下面是一个示例应用程序: HTML 文件:https ://d3qov000jfn2nk.cloudfront.net/test-oauth-stackoverflow/oauth-test.html
清单文件: https ://d3qov000jfn2nk.cloudfront.net/test-oauth-stackoverflow/test-app.xml