Reputation: 1029
I have a question in mind.
Is this possible?
I need to put the login page of our other site into an iframe. and when logged in you will see a graph.
What I need is when I click the hyperlink is it will show the page in the iframe but autofill and auto- logged in the account so that what they will see is not the login page but the graph inside it.
Is there a way to pass the username and password in the iframe and trigger the logged in button or auto logged in?
Can do this in PHP or jquery?
Regards to all and thanks in advance.
Upvotes: 1
Views: 11696
Reputation: 13766
The only caveat in Treffynnon's answer is that it requires you to have access to both systems to create a sort of "login code" web service that the two can use to communicate. If you only have access to the first site (the one that you want to include the iframe on), what I would do is the following (please note that this is not as secure as Treffynnon's answer):
Potential issues:
Upvotes: 3
Reputation: 21563
Do not expose the password rather create a unique key you can send over with them to authenticate them on the page that will be displayed in the iframe. This assumes that both systems are aware of the user and the unique key.
When you setup the iframe you can set its source to include some URL parameters:
<iframe src="http://example.org/api?key=<?php echo $unique_key; ?>">
This will get you around cross domain issues that a javascript method of doing this would throw up.
Upvotes: 2
Reputation: 601
The first what you can try, is sending the username and password with GET
method in iframe. Like src=yourscript.php?user=me&pass=secret
so you can try to auth the user on the other side.
Upvotes: 1