omniauth-weasyl 0.1 → 0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/omniauth/strategies/weasyl.rb +14 -10
- data/omniauth-weasyl.gemspec +1 -1
- metadata +1 -1
@@ -4,13 +4,17 @@ require 'omniauth-oauth2'
|
|
4
4
|
module OmniAuth
|
5
5
|
module Strategies
|
6
6
|
class Weasyl < OmniAuth::Strategies::OAuth2
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
def initialize(app, consumer_key = nil, consumer_secret = nil, options = {}, &block)
|
8
|
+
site = options[:site] || 'https://www.weasyl.com'
|
9
|
+
opts = {
|
10
|
+
:client_options => {
|
11
|
+
:site => site,
|
12
|
+
:authorize_url => site + '/api/oauth2/authorize',
|
13
|
+
:token_url => site + '/api/oauth2/token',
|
14
|
+
},
|
15
|
+
}
|
16
|
+
super(app, consumer_key, consumer_secret, opts, &block)
|
17
|
+
end
|
14
18
|
|
15
19
|
uid { raw_info['userid'].to_s }
|
16
20
|
|
@@ -28,15 +32,15 @@ module OmniAuth
|
|
28
32
|
|
29
33
|
def access_token
|
30
34
|
::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
|
31
|
-
:mode => :
|
35
|
+
:mode => :header,
|
32
36
|
:param_name => 'oauth2_access_token',
|
33
37
|
:expires_in => oauth2_access_token.expires_in,
|
34
|
-
:expires_at => oauth2_access_token.expires_at
|
38
|
+
:expires_at => oauth2_access_token.expires_at,
|
35
39
|
})
|
36
40
|
end
|
37
41
|
|
38
42
|
def raw_info
|
39
|
-
|
43
|
+
MultiJson.load access_token.get('/api/whoami').body
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
data/omniauth-weasyl.gemspec
CHANGED