有很多网站都需要实现qq,微信登录
1.准备工作
微信需要先在微信开放平台进行注册(https://open.weixin.qq.com/),并认证一个网站应用。
qq需要访问 https://connect.qq.com/manage.html 创建网站应用,填写网站基本信息以及平台信息,提交审核。注:网站回调域后续会用到,是点击授权登录时回调地址,需要与后续开发一致。
2.开发
微信
/**
* 微信开放平台二维码连接
*/
public final static StringOPEN_QRCODE_URL="https://open.weixin.qq.com/connect/qrconnect?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_login&state=%s#wechat_redirect";
/**
* QQ登录二维码地址
*/
public final static StringQQ_QRCODE_URL="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=%s&redirect_uri=%s&state=%s&scope=get_user_info";
二维码即可生成
网友评论