これを実装する方法を探して試してみて丸一日を費やした後、私はここで尋ねることになりました。これは質問ではなく問題であることはわかっていますが、それでも我慢してください。
問題 - 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に書いた2行で、それ自体(ポップアップウィンドウ)を閉じ、親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&oauth_token=4%252FilQ0z3IvyKFSDPUOqQe_RgBH2ZbI">referring page</a>
%3f
の代わりに?
、の&
代わりに見ることができます&
なぜこうなった?