4
votes

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!

1
Token will be generated for particular App say CRM, that may not authenticate you to your custom app as url differs..Arun Vinoth
Hello @ArunVinoth, my application already has the capability to use single sign-on, I am able to use the token generated by Office 365 products to login into my application. Was expecting to the do the same in Dynamics 365.sanktify

1 Answers

1
votes

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