PHP External Oauth : how to displaying a waiting message while waiting for callback (not using AJAX)

一笑奈何 提交于 2019-12-12 05:15:24

问题


We allow external OAuth using PHP APIs to several social networks. When the user choose external authentication, a new window (popup) is opened, where the application asks authorization. Then, still in the popup, the user is redirected using the callback url given to the external application. The callback script performs various tasks (login, checks, synchronization,...) that may requires some time, before the popup is closed, and the mother page updated. While those task are performed, the popup is just blank.

What I would like is to display a "please wait..." message on the popup when the callback url is called. One solution is that the popup just display the message and pass an AJAX, but as I don't know the parameters of the callback (that depends on the external application), I would like to avoid this. Is there any way to do it with only one PHP script ?


回答1:


You can perform the authorization in an iFrame (will require additional work to sync the iframe with the popup to get to the behaviour you have in mind) and design the window as you desire.

You can also just set the title.




回答2:


As the service will return you to your server - you can try next: 1. Set transfer encoding to chunked. 2. Echo javascript document.write with loader img. 3. Do your processing. 4. Close the window after processing ends.



来源:https://stackoverflow.com/questions/13562027/php-external-oauth-how-to-displaying-a-waiting-message-while-waiting-for-callb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!