0

在花了一整天的时间搜索和尝试可以实现这一点的方法之后,我最终在这里问,我希望我能得到我想要实现的目标。我知道这是一个问题而不是一个问题,但仍然忍受我。

问题 - 我正在使用 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 的 url 时,url 是

<a href="http://localhost/contacts.php%3foauth_verifier=f2hkTKLNSeZa7-2hc1II-7kQ&amp;oauth_token=4%252FilQ0z3IvyKFSDPUOqQe_RgBH2ZbI">referring page</a>

你可以看到%3f而不是?&amp;而不是&

为什么会这样?

4

0 回答 0