Passing Credentials Between Application and IFrame

3.5k Views Asked by At

I have a web application (A) which contains an iframe. The iframe includes another web application (B).

Supposed I log into web application A and 5 different iframes are displayed hosting 5 different modules. One of those modules is a CRM application that requires user login. How can I pass the credentials of the logged on user in web application A to this CRM module (web application B) that is hosted in an iframe?

enter image description here

3

There are 3 best solutions below

0
On

I assume your using Forms Authentication, this article describes how you can share credentials accross multiple sites

1
On

Assuming it's Dynamics CRM we're talking about, you can retrieve user information via a simple WhoAmIRequest, which will retrieve the current user information (based on the systemuser entity). You already login into the CRM anyway, so it shouldn't be much different from what you already did (or I assume you did)

I think the SDK has a sample doing exactly that, you might want to look it up.

0
On

A preferable method is to use JQuery.
There is post messaging concept, in that and i have used this in several projects. If you are not aware of it, then click this link.

If you surf in internet, you can found many posts related to it.

For your feasibility, i have placed below link which will be useful to you:

jquery-postmessage-plugin

jquery-ba-postmessage-js

postmessage.freebaseapps.com

EX:

pm({
  target: window.frames["example2"],
  type:"message2", 
  data:{hello:"world"}, 
  success: function(data) {
    $("#example2").after(JSON.stringify(data));
  }
});

pm.bind("message2", function(data) {
  $(document.body).append(JSON.stringify(data));
  return {foo:"bar"};
});

Let me know if this is not helping you.