部分接口开发中,实际效果以上线为准
unionid,会自动关联,取关亦会自动解除关联unionid不会自动注册code,再换取token,这时只能返回openidopenid获取用户基本信息,先判断是否关注(subscribe是否为1),如果已关注,则提取unionid(未关注也不会返回该字段)unionid,如果存在就自动关联小程序的openid,如果不存在则创建账号https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxdef22b8a24756658&redirect_uri=https%3A%2F%2Fdev.zyworks.com&response_type=code&scope=snsapi_base&state=weixin_h5_login#wechat_redirecthttps://dev.zyworks.com/?code=041MvTll2c0wif4ZvOkl2XxPxm2MvTln&state=weixin_h5_login{
"ToUserName": "gh_28173542b237",
"FromUserName": "o3W7o612ACbxaw01FgPfCNsfm-SU",
"CreateTime": "1742788087",
"MsgType": "event",
"Event": "subscribe",
"EventKey": ""
}iOS或Android Mobile(必须二者同时出现,否则有可能是安卓平板),如果是,可通过如下链接跳转到小程序weixin://dl/business/?appid=wx2350ae1680aa9a9f&path=pages/index/indexwx.login登录,只有code,自定义state为weixin_mp_logincodecode获取用户基本信息,会同时返回openid和unionidunionid,如果存在就自动关联小程序的openid,如果不存在则创建账号wx.miniapp.login),然后带code换取token,同时返回openid和unionidhttps://account.bilibili.com/pc/account-pc/auth/oauth?client_id=56dc6fedb1644f10&gourl=https%3A%2F%2Fdev.zyworks.com&state=bilibili_loginhttps://account.bilibili.com/h5/account-h5/auth/oauth?navhide={navhide}&callback={callback}&gourl={gourl}&client_id={client_id}&state={state}POST https://api.bilibili.com/x/account-oauth2/v1/token//请求
{
"client_id":"56dc6fedb1644f10",
"client_secret":"945a8827747e408b837e21d466b78ee3",
"grant_type":"authorization_code",
"code":"a3f663c714d749c0b4e5a0eb6cafb0f7"
}
//返回
{
"code":0, //错误码
"message":"0", //提示信息
"ttl":1,
"data":{
"access_token":"e4b831634aa4ca6388f6046380a6a871", //接口凭证
"expires_in":1737515172, //过期时间,有效期约180天
"refresh_token":"61ed53f5276489d591dedf670caebe71", //续期令牌
"scopes":["USER_INFO","USER_DATA","ARC_BASE","ARC_DATA"] //用户已授权的权限点
}
}GET https://member.bilibili.com/arcopen/fn/user/account/info?client_id=56dc6fedb1644f10&access_token=e4b831634aa4ca6388f6046380a6a871{
"code": 0,//错误码
"message": "0", //提示信息
"ttl": 1,
"request_id": "66cfc356e6b74cf2219404e44e66a317", //请求id
"data": {
"face": "https://i2.hdslb.com/bfs/face/a2969fcf568689f1f6939bbf619c3c694c4655d4.jpg", //头像
"name": "初心正圆", //昵称
"openid": "d70c822638074fb0b7cf736fd58750b8" //用户id
},
}https://api.weibo.com/oauth2/authorize?client_id=1152935517&response_type=code&redirect_uri=https%3A%2F%2Fpassport.zyworks.com%2Floginaccess_token有效期30d(应用未过审为24h)POST https://api.weibo.com/oauth2/access_token?client_id=1152935517&client_secret=8e635b3a5e5971c52dbffcf3031340cb&grant_type=authorization_code&redirect_uri=https%3A%2F%2Fbm.zyworks.org.cn%2Flogin&code=1d13f1c2b061ecdd3f52ea01d581ed44 (body传入空对象){
"access_token": "2.00HWmjLIJMbBQBdead223ecaW_ap1C",
"remind_in": "125665",
"expires_in": 125665,
"uid": "7502513615",
"isRealName": "true"
}GET https://api.weibo.com/2/users/show.json?access_token=2.00HWmjLIJMbBQBdead223ecaW_ap1C&uid=7502513615{
"id": 7502513615, //用户UID
"idstr": "7502513615", //字符串型的用户UID
"class": 1,
"screen_name": "初心正圆", //用户昵称
"name": "初心正圆", //友好显示名称
"province": "100", //用户所在省级ID
"city": "1000", //用户所在城市ID
"location": "其他", //用户所在地
"description": "", //用户个人描述
"url": "", //用户博客地址
"profile_image_url": "https://tvax3.sinaimg.cn/crop.0.0.1000.1000.50/008bJMw7ly8hc5nzasjx2j30rs0rs0vd.jpg?KID=imgbed,tva&Expires=1721992333&ssig=svrYf17CrF", //用户头像地址(中图),50×50像素
"light_ring": false,
"cover_image_phone": "https://ww1.sinaimg.cn/crop.0.0.640.640.640/9d44112bjw1f1xl1c10tuj20hs0hs0tw.jpg",
"profile_url": "u/7502513615", //用户的微博统一URL地址
"domain": "", //用户的个性化域名
"weihao": "", //用户的微号
"gender": "m", //性别,m:男、f:女、n:未知
"followers_count": 239, //粉丝数
"followers_count_str": "239", //字符串型的粉丝数
"friends_count": 161, //关注数
"pagefriends_count": 7,
"statuses_count": 78, //微博数
"video_status_count": 3,
"video_play_count": 0,
"super_topic_not_syn_count": 0,
"favourites_count": 8, //收藏数
"created_at": "Mon Sep 14 09:35:27 +0800 2020", //用户创建(注册)时间
"following": false, //暂未支持
"allow_all_act_msg": false, //是否允许所有人给我发私信
"geo_enabled": true, //是否允许标识用户的地理位置
"verified": true, //是否是微博认证用户
"verified_type": 0, //认证类型,暂未支持
"remark": "", //用户备注信息,只有在查询用户关系时才返回此字段
"insecurity": {
"sexual_content": false
},
//用户的最近一条微博信息字段
"status": {
//微博的可见性及指定可见分组信息。该object中type取值,0:普通微博,1:私密微博,3:指定分组微博,4:密友微博;list_id为分组的组号
"visible": {
"type": 0,
"list_id": 0
},
"created_at": "Thu Jul 04 18:45:53 +0800 2024", //微博创建时间
"idstr": "5052485821794342", //字符串型的微博ID
"mid": "5052485821794342", //微博MID
"can_edit": false,
"show_additional_indication": 0,
"text": "转发微博", //微博信息内容
"source_allowclick": 1,
"source_type": 2,
"source": "<a href=\"http://weibo.com/\" rel=\"nofollow\">Android</a>", //微博来源
"favorited": false, //是否已收藏
"truncated": false, //是否被截断
"in_reply_to_status_id": "", //(暂未支持)回复ID
"in_reply_to_user_id": "", //(暂未支持)回复人UID
"in_reply_to_screen_name": "", //(暂未支持)回复人昵称
"pic_urls": [], //微博配图url
"geo": null, //地理位置
"is_paid": false,
"mblog_vip_type": 0,
"annotations": [
{
"client_mblogid": "40d3cd23-9fb8-4804-b7ac-a96066ace4de"
},
{
"mapi_request": true
}
],
"reposts_count": 0,
"comments_count": 0,
"reprint_cmt_count": 0,
"attitudes_count": 0,
"mixed_count": 0,
"pending_approval_count": 0,
"isLongText": false,
"reward_exhibition_type": 0,
"show_mlevel": 0,
"biz_feature": 0,
"hasActionTypeCard": 0,
"darwin_tags": [],
"ad_marked": false,
"hot_weibo_tags": [],
"mblogtype": 0,
"item_category": "status",
"rid": "0",
"userType": 0,
"more_info_type": 0,
"positive_recom_flag": 0,
"content_auth": 0,
"gif_ids": "",
"is_show_bulletin": 2,
"is_show_mixed": false,
"comment_manage_info": {
"comment_permission_type": -1,
"approval_comment_type": 0,
"comment_sort_type": 0,
"ai_play_picture_type": 0
},
"repost_type": 1,
"pic_num": 0,
"hot_page": {
"fid": "232532_mblog",
"feed_detail_type": 0
},
"can_reprint": false,
"new_comment_style": 0,
"mlevel": 0,
"hide_flag": 0
},
"ptype": 0,
"allow_all_comment": true, //是否允许所有人对我的微博进行评论,true:是,false:否
"avatar_large": "https://tvax3.sinaimg.cn/crop.0.0.1000.1000.180/008bJMw7ly8hc5nzasjx2j30rs0rs0vd.jpg?KID=imgbed,tva&Expires=1721992333&ssig=bOkdPdE7Ry", //用户头像地址(大图),180×180像素
"avatar_hd": "https://tvax3.sinaimg.cn/crop.0.0.1000.1000.1024/008bJMw7ly8hc5nzasjx2j30rs0rs0vd.jpg?KID=imgbed,tva&Expires=1721992333&ssig=G6MUITYlee", //用户头像地址(高清),高清头像原图
"verified_reason": "正圆工坊 创始人", //认证原因
"verified_trade": "",
"verified_reason_url": "",
"verified_source": "",
"verified_source_url": "",
"verified_state": 0,
"verified_level": 3,
"verified_type_ext": 0,
"has_service_tel": false,
"verified_reason_modified": "",
"verified_contact_name": "",
"verified_contact_email": "",
"verified_contact_mobile": "",
"follow_me": false, //该用户是否关注当前登录用户
"like": false,
"like_me": false,
"online_status": 0, //用户的在线状态,0:不在线、1:在线
"bi_followers_count": 1, //用户的互粉数
"lang": "zh-cn", //用户当前的语言版本,zh-cn:简体中文,zh-tw:繁体中文,en:英语
"star": 0,
"mbtype": 2,
"mbrank": 2,
"svip": 1,
"vvip": 0,
"mb_expire_time": 1716566399,
"block_word": 0,
"block_app": 0,
"chaohua_ability": 0,
"brand_ability": 0,
"nft_ability": 0,
"vplus_ability": 0,
"wenda_ability": 0,
"live_ability": 0,
"gongyi_ability": 0,
"paycolumn_ability": 0,
"newbrand_ability": 0,
"ecommerce_ability": 0,
"hardfan_ability": 0,
"wbcolumn_ability": 0,
"interaction_user": 0,
"audio_ability": 0,
"place_ability": 0,
"credit_score": 80,
"user_ability": -2145124352,
"cardid": "star_11620_common",
"urank": 0,
"story_read_state": -1,
"verified_detail": {
"custom": 0,
"data": [
{
"key": 1,
"sub_key": 0,
"weight": 100,
"desc": "正圆工坊 创始人",
"timestamp": 0
}
]
},
"vclub_member": 0,
"is_teenager": 0,
"is_guardian": 0,
"is_teenager_list": 0,
"pc_new": 7,
"special_follow": false,
"planet_video": 2,
"video_mark": 2,
"live_status": 0,
"user_ability_extend": 0,
"status_total_counter": {
"total_cnt": 104,
"repost_cnt": 0,
"comment_cnt": 36,
"like_cnt": 66,
"comment_like_cnt": 2
},
"video_total_counter": {
"play_cnt": 3124
},
"brand_account": 0,
"hongbaofei": 0,
"green_mode": 0,
"urisk": 9354439294976,
"unfollowing_recom_switch": 1,
"block": 0,
"block_me": 0,
"avatar_type": 0,
"is_big": 0,
"auth_status": 1,
"auth_realname": null,
"auth_career": null,
"auth_career_name": null,
"show_auth": 0,
"is_auth": 0,
"is_punish": 0,
"avatar_hd_pid": "008bJMw7ly8hc5nzasjx2j30rs0rs0vd",
"like_display": 0
}GET https://open.douyin.com/platform/oauth/connect?client_key=awv5m4r7qaamsrbv&response_type=code&scope=user_info&redirect_uri=https%3A%2F%2Fbm.zyworks.org.cn%2Flogin&state=douyin_loginhttps://bm.zyworks.org.cn/login?code=012aa33570e3594ehGOlwYDYnvv0e1uPR1Co_hl&state=douyin&scopes=user_infoclient_key: awv5m4r7qaamsrbv
client_secret: 7d6702e6a3b231f85aee5887fe293f33
code: 012aa33570e3594ehGOlwYDYnvv0e1uPR1Co_hl
grant_type: authorization_code{
"data": {
"access_token": "act.3.trQDna9gpCX3isi4zjCobrBhSx3uLso8OPRCsmJjKDxWkHo8At6mQPa3V2vu-dC02IbJxPDDkwpNWhHf9f2WJoxJC74w3vM3CRYe1WMDwsGAytZ1agGaTtwKnXlBItCGTxEmoJt0bXhyiIJ9yjvaDfEXaIfN0tjEqUWzgA==_hl", //接口调用凭证
"captcha": "",
"desc_url": "",
"description": "",
"error_code": 0, //错误码,0为正常,非0可到description查原因
"expires_in": 1296000, //access_token超时时间,单位秒,此处为15d
"log_id": "2024083123185313F46F6204360FC66078",
"open_id": "_000JIUrJGCFxzfEvh2npY6M0yAcPkBnZZmf", //用户唯一标识
"refresh_expires_in": 2592000, //refresh_token超时时间,单位秒,此处为30d
"refresh_token":"rft.a03ea****EvB_hl", //用户刷新access_token的凭证
"scope": "user_info" //用户授权的作用域(Scope),以英文逗号分隔
},
"message": "success" //状态信息
}{
event: 'authorize',
client_key: 'awv5m4r7qaamsrbv',
from_user_id: '_000JIUrJGCFxzfEvh2npY6M0yAcPkBnZZmf',
content: { scopes: [ 'user_info' ] },
log_id: '02174281021589600000000000000000000ffff0a1a371ecc3006',
event_id: ''
}