In my plugin I implemented sign in functionality with outlook dialog API. It loads a credentials form (not in my control) with a back url. The sign in response correctly comes at my node server and I see that the user is authenticated. There on the server, an ejs file is prepared and is sent to client. Back on the client I want to execute messageParent, so I can close the dialog. This works in browsers (including safari), android, desktop and etc, it's working in Outlook for MAC but doesn't work on iOS. Sample code following:
in nodejs:
app.post("/auth/:token", (req, res) => {
console.log('auth return url logic', req.params.token, JSON.stringify(req.body));
let send_response = function(res, user) {
try {
return res.render(
'send_to_parent.ejs',
{user : user},
function (e, r) {
try {
res.end(r);
}
catch(e) {}
}
);
}
catch (err) {
console.log(1312312321, err);
}
};
send_response(res, {});
});
in send_to_parent.ejs
<!DOCTYPE html>
<html>
<head>
<title>#Sign in</title>
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
console.log('in ejs');
function messageParent() {
console.log('message parent');
Office.context.ui.messageParent(true);
}
function openClick() {
window.setTimeout(messageParent, 100);
}
Office.initialize = function (reason) {
console.log('office initialize');
$(document)
.ready(function () {
console.log('jquery ready');
openClick();
});
};
</script>
</head>
Any ideas what is wrong or how to diagnose?
from Dialog in Outlook web plugin for mobile doesn't not work only on IOS
No comments:
Post a Comment