Eriton Silva
Eriton Silva

Reputation: 131

How can i Load Call Back Sso out of Iframe

I have a Sso url that I need call for authenticate my user, and I want load this url in a iframe modal, but after the SSo authentication, the sso trigger a callback url in my application, and now this url are load in the iframe modal, i would like this callback show my page out of the iframe modal, and close the iframe modal.

I try use load, for do not use iframe, but i get cors origin error

<div id="modalSSO" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" id="modalSSoBody" >
                <iframe  id="iframeModal" style="width:440px;height:500px"  sandbox="allow-top-navigation allow-scripts allow-forms">
                </iframe>
            </div>
        </div>

    </div>
</div>

 $('#btnSso').click(function(){
   $('#iframeModal').prop('src', ssoUrl);
   $("#modalSSO").modal();
 })

Upvotes: 0

Views: 275

Answers (1)

Eriton Silva
Eriton Silva

Reputation: 131

I used this approach for break out the iframe after receive a callback of Sso:

if (window.location !== window.top.location) {
            window.top.location = window.location;
        } 

Upvotes: 1

Related Questions