经过一整天的搜索和尝试,我可以实现这一点,我最终在这里问,我希望我能得到我想要实现的目标。我知道这不是一个问题,但仍然与我有关。
问题 - 我使用google oauth获取用户的联系人,一切都已设置,应用程序流程
user clicks on button -> modal appears which has iframe (gmail_connect.php)
which has link to get user authorized -> when clicked on that link I am opening a
popup in which I am authorizing the user -> when user is authorized -> user will be
redirected to contacts.php in that popup window -> but I have
written js in contacts.php which will close itself and reload the iframe from which
the window was opened with contacts.php with all the parameters.
以下是我在contacts.php中编写的那两行,它关闭了自己(弹出窗口)并将父iframe的位置设置为弹出窗口所具有的url。
<?php
$oauth_verifier = $_GET['oauth_verifier'];
$oauth_token = $_GET['oauth_token'];
?>
<script>
window.opener.location.href = 'contacts.php?oauth_verifier=<?= $oauth_verifier?>&oauth_token=<?= $oauth_token;?>';
window.close();
<script>
问题是我得到404错误,这很明显因为当我检查iframe的网址时,网址是
<a href="http://localhost/contacts.php%3foauth_verifier=f2hkTKLNSeZa7-2hc1II-7kQ&oauth_token=4%252FilQ0z3IvyKFSDPUOqQe_RgBH2ZbI">referring page</a>
您可以看到%3f
而不是?
和&
而不是&
为什么会这样?