Qq interconnected js SDK: http://wiki.connect.qq.com/js_sdk%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E
Copy codeThe Code is as follows:
<Script type = text/javascript>
Introduce <script type = "text/javascript" in the page header"
Src = "http://qzonestyle.gtimg.cn/qzone/openapi/qc_loader.js"
Data-appid = "appid" data-redirecturi = "huidiaodizhi (with http )"
Charset = "UTF-8"> </script>
Add the following information to the body:
// Set the qq sharing button
QC. Login (
{
BtnId: "qqLoginBtn" // node id of the insert button
},
Function (reqData, opts) {// login successful
// Change the button display status based on the returned data
Var dom = document. getElementById (opts ['btnid']), _ logoutTemplate = [
// Avatar
'<Span> </span> ',
// Nickname
'<Span> {nickname} </span> ',
// Exit
'<Span> <a href = "javascript: QC. Login. signOut ();"> exit </a> </span>']
. Join ("");
Dom
& (Dom. innerHTML = QC. String
. Format (
_ LogoutTemplate,
{
Nickname: QC. String
. EscHTML (reqData. nickname), // perform xss Filtering
Figureurl: reqData. figureurl
}));
},
Function (opts) {// logout successful
Alert ("logout successful !! ");
});
// Call api authorization
QC. api ("get_info ",{
"Oauth_consumer_key": "appid" // you do not need to pass this parameter.
}). Success (function (s ){
If (QC. Login. check () {// check whether the logon is successful, and the openid and accessToken are displayed.
QC. Login. getMe (function (openId, accessToken ){
Alert (openid + "" + accessToken );
});
}
});
</Script>
<Div class = "lib_tiv shadow">
<H3 class = "logo"> QQ logon </Div>