How to stay inside outlook Add-in when authenticating
Posted: Wed Jan 11, 2023 11:53 pm
Hi all,
now another interesting problem, Servoy is running inside an iFrame in Microsoft Outlook and I want to Authenticate against Azure AD.
Now, application.showURL, simply adds another tab to my web browser, displays the authentication dialog from Microsoft. If I authenticate, I end up with a normal Servoy running in my browser.
I want to stay within Microsoft Outlook, how can I show the service.getAuthorizationURL() so I can authenticate?
now another interesting problem, Servoy is running inside an iFrame in Microsoft Outlook and I want to Authenticate against Azure AD.
- Code: Select all
function authorize() {
var service = plugins.oauth.getOAuthService(plugins.oauth.OAuthProviders.MICROSOFT_AD, clientId, clientSecret, 'User.read', state, callback);
application.showURL(service.getAuthorizationURL());
}
function microsoft_ad_callback(a,args) {
var service = plugins.oauth.getOAuthService(plugins.oauth.OAuthProviders.MICROSOFT_AD, clientId, clientSecret, 'User.read', state, callback);
service.setAccessToken(args.code);
/** @type {plugins.oauth.OAuthResponseJSON} */
var response = service.executeGetRequest("https://graph.microsoft.com/v1.0/me");
if (response.getCode() == 200) {
var json = response.getAsJSON();
//more code here
} else {
//failed
}
}
Now, application.showURL, simply adds another tab to my web browser, displays the authentication dialog from Microsoft. If I authenticate, I end up with a normal Servoy running in my browser.
I want to stay within Microsoft Outlook, how can I show the service.getAuthorizationURL() so I can authenticate?