sanktify
sanktify

Reputation: 65

Open a custom web-application within Dynamics-365 Online using single sign-on

I have been working on something, wherein I have to try and open an existing Office 365 based web-application within Dynamics 365 portal (online). Login into the web-application using the single sign-on provided by Office 365 or the authentication token of the currently logged in user.

To be precise, the operation steps:

  1. Login into Dynamics 365
  2. Click on a button to open the web-application ( within an iFrame or something)
  3. Login into the web-application using the token from the context of the currently logged in user. [ This is where I need help ]

I have tried to open the application using a ribbon button, but the Microsoft login pop-up is blocked by Dynamics 365.

I have been browsing various community pages and blogs, but none of them demonstrate the login procedure or a sample code.

If anyone can provide some sample code or some blog or even a direction which demonstrates the same, it will be of great help!

Upvotes: 4

Views: 1958

Answers (1)

Marcelo Acosta
Marcelo Acosta

Reputation: 189

According to your question you have 2 problems

  1. Open an external website in an IFrame/Popup
  2. The external website be authenticated with the current CRM user

Problem 1

You could create an HTML WebResource and redirect the page using a FORM tag with action to your website with a JS code in the load event. (you will need to communicate with a HTTPS website, otherwise, the browser security will block the invocation)

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" charset="utf-8">
    <title>Redirect</title>
    <script src="../../../ClientGlobalContext.js.aspx" type="text/javascript">/script>
    <script>
        $(window).on('load', function () {
           $("#FormId").attr('action', "HTTPS://WebSite.COM");
           $("#FormId").submit();
        });
    </script>

</head>
<body>
    <form id="FormId>
    </form>
 </body>

Problem 2

You will need to register your application in the Azure-AD of the Dynamics CRM instance and configurate the Azure-AD authetication in the corresponding WebSite

Hope It Helps

Upvotes: 2

Related Questions