微博如何用qq号登录,微博怎么登qq号

首页 > 实用技巧 > 作者:YD1662024-01-09 16:00:21

第二步:

微博如何用qq号登录,微博怎么登qq号(5)

提交完之后会自动提交审核,基本上就是审核你的资料和备案的资料是否一致,所有资料必须和备案资料一模一样,否则审核不会通过:

微博如何用qq号登录,微博怎么登qq号(6)

当然,这些资料后面还是可以修改的。申请成功之后你会得到appId和appKey。

3.3. 引导用户登录

这里可以下载一些视觉素材,在页面合适位置放一个QQ登录按钮,点击时引导用户进入授权页面:

微博如何用qq号登录,微博怎么登qq号(7)

代码:

function openWindow(url, width, height) { width = width || 600; height = height || 400; var left = (window.screen.width - width) / 2; var top = (window.screen.height - height) / 2; window.open(url, "_blank", "toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, left=" left ", top=" top ", width=" width ", height=" height); } ​ function qqLogin() { var qqAppId = '424323422'; // 上面申请得到的appid var qqAuthPath = 'http://www.test.com/auth'; // 前面设置的回调地址 var state = 'fjdslfjsdlkfd'; // 防止CSRF攻击的随机参数,必传,登录成功之后会回传,最好后台自己生成然后校验合法性 openWindow(`https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=${qqAppId}&redirect_uri=${encodeURIComponent(qqAuthPath)}&state=${state}`); }

然后会打开一个授权页面,这个页面大家应该都熟悉:

微博如何用qq号登录,微博怎么登qq号(8)

上一页123下一页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.