npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

renren

v0.0.3

Published

nodejs版人人网oauth认证和api sdk

Downloads

2

Readme

node-renren

nodejs版人人网oauth认证和api sdk

开发中,不可用,可用后会删除此警告

#特色

  • 对接口分组。
  • 无需关心scope,传入你要使用的接口分组,自动生成scope。
  • 集成oauth2.0认证
  • 错误处理
  • 规范的代码
  • 支持图片上传

#支持的api

支持的api

#人人网api说明:

http://wiki.dev.renren.com/wiki/API

#参与者致谢:

https://github.com/willerce

#示例:

具体跟express的配合见:test/test.js


 var config = {
        app_key:"99754adae54e49bc826da1144ad2659d",
        app_secret:"ddf05a79792a4a0aac6cfb42755e25c9",
        redirect_uri:"http://localhost:8080/sina_auth_cb",
        api_group: ["blog","photos"],
        access_token:req.cookies.token
    }
var api = new RenRen(config);
//发送一篇日志
api.blog.addBlog({
        title:("hello nodejs !"),
        content:"this blog is create by nodejs :https://github.com/xinyu198736/node-renren",
        access_token:(req.cookies.token)
    }, function (error,data) {
        console.log(data); //人人网的api错误信息不统一,不能统一处理,这里只是返回一个字符串,自己处理。
    });
//获取两个好友的共同好友并发送一条状态
api.friends.getSameFriends({
        uid1:83838506,
        uid2:230901848,
        fields:"uid,name",
        access_token:(req.cookies.token)
    }, function (error,data) {
        console.log(data);
        var data = JSON.parse(data);
        var text="系统判断,我和@孙歌(230901848) 的共同好友有:"
        data.friends.forEach(function(person){
            text+="@"+person.name+"("+person.uid+")"+" ";
        })
        api.status.set({
            status:text,
            access_token:(req.cookies.token)
        })
    }); 
//上传一个照片
api.photos.upload({
        upload:path.join(__dirname, "/test.jpg"),
        caption:"upload by nodejs"
    },function(error,data){
        console.log(data)
    })

oauth认证方法:

var config = {
        app_key:"99754adae54e49bc826da1144ad2659d",
        app_secret:"ddf05a79792a4a0aac6cfb42755e25c9",
        redirect_uri:"http://localhost:8080/sina_auth_cb",
        api_group: ["blog","photos"],
        access_token:req.cookies.token
    }
var app_auth = {
    auth:function (req, res) {
        var api = new RenRen(config);
        var auth_url = api.oauth.authorize();
        res.redirect(auth_url);
        res.end();
    },
    sina_auth_cb:function (req, res) {
        var code = req.query.code;
        var api = new RenRen(config);
        api.oauth.accesstoken(code, function (data) {
            res.cookie("token", data.access_token);
            res.redirect('oauth');
            res.end();
        })

    }
}