Many websites have such a third-party login function. Click to log in and a small window will pop up. After confirming on the small window, it will be closed immediately and the avatar on the main page will be loaded. Came out,. ,,How is this achieved? Partial refresh must involve ajax, but the address in the small window in the picture is completely a third-party interface. How can I use ajax to control and return information to the main page?
Many websites have such a third-party login function. Click to log in and a small window will pop up. After confirming on the small window, it will be closed immediately and the avatar on the main page will be loaded. Came out,. ,,How is this achieved? Partial refresh must involve ajax, but the address in the small window in the picture is completely a third-party interface. How can I use ajax to control and return information to the main page?
The poster can take a look at the oauth login authorization, https://segmentfault.com/a/1190000005177874 The poster can study this code
https://adodson.com/hello.js/
I have tried to write js for user authorization and briefly talk about the front-end aspect
This is usually the case
When the user triggers login, the program will detect whether there is a login token in the local storage, and a pop-up window will pop up or jump to our login page, which will bring some information such as application id and callback address. , after successful login, it will jump to the address specified by the callback, which is usually the original login page. When jumping to the new page at this time, the token will be brought. At this time, you can use this token to access other APIs, such as user information, friends, etc.
http://www.uyan.cc/getcode This kind of thing, just get a third party