I have an existing remote site which has Authentication to access, now I want to combine this site in my own site using iframe. Is there any solution which can help to auto login remote site when load the iframe?
<iframe src="http://remote.com/list"></iframe>
If want to access http://remote.com/list, login require and only post username/password works. How to auto login when iframe loaded?
Here are some restriction
- login only works with post method
- iframe / javascript has cross domain issue
- no login API provide
- no other modification can do in remote site
If you own the other site then you can try authentication through some token.
Pass an authorized token to url in the iframe.
Here is my implementation for doing this. This does not solve the cross-domain issue though. For the cross-domain issue, you can try using jQuery's JSONP method (I haven't tried combining jQuery with this solution yet).
Can't be done. Simple as that. The cross domain restrictions are in place quite specifically to stop you from being able to do something like that.
Everything's possible. However the solution below is very insecure due to disclosure of access details to the remote page.
The values of
username
andpassword
inputs are readable on the client side.