0

私は最近、これと非常によく似た質問を投稿しましたが、javascript を使用してこれを実装し、完全に別のウィンドウで開いていました。それ以来、私はさらに進歩し、Twitter ブートストラップの実装を開始し、ウィンドウを開かずにこの同じアイデアを実装するには、モーダルを使用するのが最適だと考えました。

同様の投稿を読んだところ、「オリジン ポリシーの制限」が原因である可能性があることがわかりました。

私が実行しているのは、Django 1.6.1、Python-Social-Auth、および Twitter Bootstrap です。次のようなリンクがあります。

<a class="loginModalLink" 
    href="{% url 'social:begin' 'linkedin-oauth2' %}"
    data-target="#loginModal" data-toggle="modal">
    <button type="button" class="btn btn-success btn-xs">
    <span class="glyphicon glyphicon-user"></span>
    Sign In
    </button>
</a>

そして対応するモーダル。

<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">Modal header</h3>
            </div>
            <div class="modal-body">One fine body...
            </div>
        </div> <!-- ./modal-content -->
    </div> <!-- ./modal-dialog -->
</div>

また、モーダルで data-remote="" タグを使用してみましたが、うまくいきませんでした。

Javascript コンソールに表示されるエラーは次のとおりです。

XMLHttpRequest cannot load https://www.linkedin.com/uas/oauth2/authorization?scope=r_basicprofile+r_em…mZhzisE8BHHksx6bOFDOnxDMKX4dS0&response_type=code&client_id=75l485e9k29snc. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access.

以前にこの問題に遭遇し、その方法を見つけた人はいますか

4

0 に答える 0