1

I'm coding a php framework to add functionalities for a second party website, which is not ours and don't have control at all.

This website has Oauth 2.0 authorization for its clients and save access token in cookies. As I must interact with their own public API, I need to read that token to make my requests.

Question is.. which is the best strategy to code that? I'm not a php programmer but very proficient in C++. I wonder if its possible to open website inside an IFRAME and read cookies with javascript, am I making any sense????

4

1 回答 1

0

如果您真的想这样做,请在隐藏的 iframe 中打开网站,iframe 加载的页面应该类似于

window.parent.getCookie(/* the cookie value*/);

所以你可以在你的主站点中使用getCookie方法并读取外部站点cookie,然后你可以使用ajax将cookie值发送到你的脚本,并使用它或将其保存为cookie,你也可以使用javascript来保存 cookie。

编辑:记住 cookie 永远不应该存储敏感数据,即使在您自己的站点中也是如此。

于 2012-04-05T16:36:12.447 回答