<Script type = text/javascript>
Introduce the following in the page header: <script type = text/javascript 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
'',
// Nickname
'{Nickname }',
// Exit
'Logout ']
. 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
}). 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 );
});
}
});
QQ Login