Penguen
Penguen

Reputation: 17288

Passing Credentials Between Application and IFrame

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

Upvotes: 5

Views: 3617

Answers (3)

VIRA
VIRA

Reputation: 1504

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.

Upvotes: 3

Alex
Alex

Reputation: 23300

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.

Upvotes: -1

JoshBerke
JoshBerke

Reputation: 67108

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

Upvotes: 1

Related Questions