omniauth-jawbone 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth/strategies/jawbone.rb +4 -84
- data/lib/omniauth-jawbone/version.rb +1 -1
- metadata +1 -1
@@ -16,20 +16,15 @@ module OmniAuth
|
|
16
16
|
class Jawbone
|
17
17
|
include OmniAuth::Strategy
|
18
18
|
|
19
|
-
# def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
|
20
|
-
#option :client_options,
|
21
|
-
#opts = {
|
22
19
|
option :client_options, {
|
23
20
|
:site => 'https://jawbone.com',
|
24
21
|
:authorize_url => '/auth/oauth2/auth',
|
25
22
|
:token_url => '/auth/oauth2/token'
|
26
23
|
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
# super
|
32
|
-
# end
|
24
|
+
|
25
|
+
def request_phase
|
26
|
+
super
|
27
|
+
end
|
33
28
|
|
34
29
|
|
35
30
|
def authorize_params
|
@@ -74,78 +69,3 @@ end
|
|
74
69
|
|
75
70
|
|
76
71
|
OmniAuth.config.add_camelization 'jawbone', 'Jawbone'
|
77
|
-
|
78
|
-
# option :client_options, {
|
79
|
-
# :site => 'https://jawbone.com',
|
80
|
-
# :authorize_url => '/auth/oauth2/auth',
|
81
|
-
# :token_url => '/auth/oauth2/token'
|
82
|
-
# }
|
83
|
-
|
84
|
-
|
85
|
-
# def client
|
86
|
-
# ::OAuth2::Client.new(ENV["CLIENT_ID"], ENV["CLIENT_SECRET"], :site => 'https://jawbone.com', :authorize_url => '/auth/oauth2/auth', :token_url => '/auth/oauth2/token')
|
87
|
-
# end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# # def request_phase
|
92
|
-
# # Omniauth::Form.build url:callback_url do
|
93
|
-
# # #text_field 'client_id', 'ENV["CLIENT_ID"]'
|
94
|
-
# # text_field 'response_type', 'code'
|
95
|
-
# # text_field 'scope', 'basic_read sleep_read'
|
96
|
-
# # text_field 'redirect_uri', "http://www.gitsleep.com/auth"
|
97
|
-
# # end
|
98
|
-
# # end
|
99
|
-
|
100
|
-
# # def self.temporary_code_to_token(code)
|
101
|
-
# # json = HTTParty.post(
|
102
|
-
# # "https://jawbone.com/auth/oauth2/token",
|
103
|
-
# # :body => {
|
104
|
-
# # :client_id => ENV["CLIENT_ID"],
|
105
|
-
# # :client_secret => ENV["CLIENT_SECRET"],
|
106
|
-
# # :grant_type => "authorization_code",
|
107
|
-
# # :code => code
|
108
|
-
# # }
|
109
|
-
# # ).body
|
110
|
-
# # return JSON.parse(json)["access_token"]
|
111
|
-
# # end
|
112
|
-
|
113
|
-
# # def self.token_to_user_info(token)
|
114
|
-
# # HTTParty.get(
|
115
|
-
# # "https://jawbone.com/nudge/api/users/@me",
|
116
|
-
# # :headers => {
|
117
|
-
# # "Authorization" => "Bearer #{token}"
|
118
|
-
# # }
|
119
|
-
# # )["data"]
|
120
|
-
# # end
|
121
|
-
|
122
|
-
# credentials do
|
123
|
-
|
124
|
-
# hash = {'token' => access_token.token}
|
125
|
-
# hash.merge!('refresh_token' => access_token.refresh_token) if access_token.expires? && access_token.refresh_token
|
126
|
-
# hash.merge!('expires_at' => access_token.expires_at) if access_token.expires?
|
127
|
-
# hash.merge!('expires' => access_token.expires?)
|
128
|
-
# hash
|
129
|
-
# end
|
130
|
-
|
131
|
-
|
132
|
-
# def user_data
|
133
|
-
# access_token.options[:mode] = :query
|
134
|
-
# user_data ||= access_token.get('/nudge/api/users/@me').parsed
|
135
|
-
# end
|
136
|
-
|
137
|
-
# end
|
138
|
-
# end
|
139
|
-
# end
|
140
|
-
|
141
|
-
|
142
|
-
# uid { user_data['xid'] }
|
143
|
-
|
144
|
-
# info do
|
145
|
-
# {
|
146
|
-
# token = token
|
147
|
-
# photo = user_info["image"]
|
148
|
-
# first_name = user_info["first"]
|
149
|
-
# last_name = user_info["last"]
|
150
|
-
# }
|
151
|
-
# end
|