omniauth_china 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -24,15 +24,16 @@ OmniAuth currently supports the following external providers:
24
24
  * Tqq (credit: [he9qi](http://github.com/he9qi))
25
25
  * Renren (Renren Connect of renren.com) (credit: [taweili](http://github.com/taweili), [rainux](http://github.com/rainux))
26
26
 
27
- ## 人人
27
+ ## 人人([taweili](http://github.com/taweili), [rainux](http://github.com/rainux))
28
28
 
29
29
  Run the generator to generate `xd_receiver.html` and include helper into ApplicationHelper:
30
30
 
31
31
  rails g omniauth_renren:install
32
32
 
33
- Place the Renren Connect button on any page by simply call `omniauth_renren_connect_button`:
33
+ Place the Renren Connect button on any page by simply call `omniauth_renren_connect_button` and `omniauth_renren_javascript`:
34
34
 
35
35
  <%= omniauth_renren_connect_button %>
36
+ <%= omniauth_renren_javascript %>
36
37
 
37
38
  Route `/auth/renren` to the page that contain Renren Connect button:
38
39
 
@@ -65,6 +66,10 @@ The hash in question will look something like this:
65
66
 
66
67
  The `user_info` hash will automatically be populated with as much information about the user as OmniAuth was able to pull from the given API or authentication provider.
67
68
 
68
- ## TOTO
69
+ ## Contributors (thanks!)
70
+ * [huacnlee](http://github.com/huacnlee)
71
+
72
+
73
+ ## TODO
69
74
 
70
75
  Write better tests!!
@@ -1,4 +1,4 @@
1
- require 'omniauth/cookie'
1
+ require 'omniauth_china/oauth_china'
2
2
 
3
3
  module OmniAuth
4
4
  module Strategies
@@ -29,7 +29,7 @@ module OmniAuth
29
29
 
30
30
  def auth_hash
31
31
  OmniAuth::Utils.deep_merge(super, {
32
- 'uid' => user_hash['screen_name'],
32
+ 'uid' => user_hash['id'],
33
33
  'user_info' => user_info,
34
34
  'extra' => {'user_hash' => user_hash}
35
35
  })
@@ -38,8 +38,8 @@ module OmniAuth
38
38
  def user_info
39
39
  user_hash = self.user_hash
40
40
  {
41
- 'username' => user_hash['name'],
42
- 'name' => user_hash['realName'],
41
+ 'username' => user_hash['screen_name'],
42
+ 'name' => user_hash['name'],
43
43
  'location' => user_hash['location'],
44
44
  'image' => user_hash['profile_image_url'],
45
45
  'description' => user_hash['description'],
@@ -35,8 +35,9 @@ module OmniAuth
35
35
  end
36
36
 
37
37
  def auth_hash
38
+ # NOTE: Tencent not give uid current, use username instead.
38
39
  OmniAuth::Utils.deep_merge(super, {
39
- 'uid' => user_hash["data"]['uid'],
40
+ 'uid' => user_hash["data"]['name'],
40
41
  'user_info' => user_info,
41
42
  'extra' => {'user_hash' => user_hash}
42
43
  })
@@ -49,7 +50,7 @@ module OmniAuth
49
50
  'name' => user_hash["data"]['nick'],
50
51
  'location' => user_hash["data"]['location'],
51
52
  'image' => user_hash["data"]['head'],
52
- 'description' => user_hash['description'],
53
+ 'description' => user_hash['data']['introduction'],
53
54
  'urls' => {
54
55
  'Tqq' => 't.qq.com'
55
56
  }
@@ -1,3 +1,3 @@
1
1
  module OmniauthChina
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Qi He
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-26 00:00:00 -07:00
17
+ date: 2011-03-30 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency