passport-weibo 返回的 profile 对象详情
文章目录
passport-weibo 是一个调用微博 OAuth 2.0 API 完成用户登录的 passport 策略。
下面是 passport-weibo 官方提供的一段示例代码:
1 | passport.use(new WeiboStrategy({ |
WeiboStrategy 的第二个元素是一个函数,函数会传回一个 profile 对象,存储了登陆者的信息。我查看了这个对象的具体具体内容。
微博返回的 profile 对象有五个属性:
- profile.provider,我没有查看这个属性的内容。
- profile.id,微博 ID。
- profile.displayName,微博昵称。
- profile._raw,我没有查看这个属性的内容,顾名思义应该是一些原始数据,可能和 _json 属性内容本质上一致。
- profile._json,以 json 的形式存储了大量用户信息。
profile._json 的属性详情如下,没写的代表我不秦楚:
- profile_url,这是用户主页的地址,用户主页地址为 ‘http://weibo.com/‘ + profile_url。
- domain,字面意思是用户域名,没有申请个性域名的用户可能这个属性为空。
- weihao,用户微号。
- gender,性别,男为 m,猜测女为 f。
- followers_count,粉丝数。
- friends_count,关注数。
- pagefriends_count
- statuses_count,微博数。
- favourites_count 46,收藏数。
- created_at Sat Apr 23 10:08:13 +0800 2011,注册时间。
- following
- allow_all_act_msg
- geo_enabled
- verified,是否加 V,值为 true/false。
- verified_type,加 V 类型,无 V 则为 -1。
- remark
- status [object Object],这还是一个对象,我没有展开查看,推测是该用户发送的微博。
- ptype
- allow_all_comment,是否允许大家评论。
- avatar_large,大头像地址。
- avatar_hd,高清头像地址。
- verified_reason
- verified_trade
- verified_reason_url
- verified_source
- verified_source_url
- follow_me
- online_status
- bi_followers_count,互粉好友数。
- lang,使用的语言。
- star
- mbtype
- mbrank
- block_word,屏蔽词数。
- block_app,屏蔽 app 数。
- credit_score,信用指数。
- urank