PHP External Oauth : how to displaying a waiting m

2019-08-29 23:31发布

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 ?

2条回答
Evening l夕情丶
2楼-- · 2019-08-29 23:48

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.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-08-29 23:55

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.

查看更多
登录 后发表回答