Recently, I was working on a small project. I received a request that I need to access a third party to log in. Without saying any more, I need to add the following external chain JS file to the index. HTML file: 111111 corresponds to the APPID applied for on a third-party platform, and 111111.com corresponds to the callback address configured on a third-party platform

Then add the corresponding event to the corresponding login button:

// wechatLogin() {

Window. The location. The replace (open.weixin.qq.com/connect/oau…).

}

/ / QQ login

qqLogin() {

Window. The location. The replace (https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=111111&redirect_uri=https%3 a%2f%2f111111.com&scope=scope)

}

// Micro-blog recording

weboLogin() {

window.location.replace(https://api.weibo.com/oauth2/authorize?client_id=111111&response_type=code&redirect_uri=https%3a %2f%2f111111.com)

}

Then the address callback can get the login code, and then use this code can request the user information to the back end ~