No commit activity in last 3 years
No release in over 3 years
OmniAuth Oauth2 strategy for renren.com
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Omniauth Renren Oauth 2

Renren oauth2 stragy form omniauth 1.0

Read Renren Oauth2 docs form more details: http://wiki.dev.renren.com/wiki

Installation

Add this line to your application's Gemfile:

gem 'omniauth-renren-oauth2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install omniauth-renren-oauth2

Usage

OmniAuth::Strategies::RenRen is simply a Rack middleware. Read the OmniAuth 1.0 docs for details instructions: https://github.com/intridea/omniauth

Here's a quick example, adding the middleware to Rails app in config/initializers/omniauth.rb

Rails.application.config.middleware.use OmniAuth::Builder do
       provider :renren, ENV['RENREN_KEY'], ENV['RENREN_SECRET']
end

Configuring

Rails.application.config.middleware.use OmniAuth::Builder do
       provider :renren, ENV['RENREN_KEY'], ENV['RENREN_SECRET'], :scope => 'read_user_feed read_user_status publish_feed publish_share' 
end

Auth Hash

Here's an example Auth Hash available in request.env['omniauth.auth']

{"provider"=>"renren",
 "uid"=> "123456789", 
 "info"=> { 
           "name"=>"test", 
           "nickname" => "test",
           "image"=>"http://hdn.xnimg.cn/photos/1.jpg", 
           "urls"=>{"Renren"=>"http://www.renren.com/222159293/profile"}},
            "credentials"=>{"token"=>"230086|32csdfg435...",
            "refresh_token"=>"230086|32csdfg435...", 
            "expires_at"=>1366628401, 
            "expires"=>true
            }, 
  "extra"=>{
     "raw_info"=>{
            "uid"=> "123456789", 
            "avatar" => [{"size" => "TINY", "url" => "http://hdn.xnimg.cn/photos/1.jpg"}]
            "name"=>"test", 
            "star"=>0, 
            "basicInformation" => { "sex" => "MALE", "birthday" => "1900-0-0"}
             }
         }
 }