@@ -51,9 +51,11 @@ def request(env)
51
51
warn <<~LOG
52
52
OAuth2 Debugging: request #{ env . method . upcase } #{ env . url . to_s }
53
53
54
- Headers: #{ env . request_headers }
54
+ Headers:
55
+ #{ env . request_headers . to_yaml }
55
56
56
- Body: #{ env [ :body ] }
57
+ Body:
58
+ #{ env [ :body ] . to_yaml }
57
59
LOG
58
60
end
59
61
@@ -63,9 +65,11 @@ def response(env)
63
65
64
66
From #{ env . method . upcase } #{ env . url . to_s }
65
67
66
- Headers: #{ env . response_headers }
68
+ Headers:
69
+ #{ env . request_headers . to_yaml }
67
70
68
- Body: #{ env [ :body ] }
71
+ Body:
72
+ #{ env [ :body ] . to_yaml }
69
73
LOG
70
74
end
71
75
end
@@ -225,19 +229,22 @@ def fetch_user_details(token, id)
225
229
user_json_url = SiteSetting . oauth2_user_json_url . sub ( ":token" , token . to_s ) . sub ( ":id" , id . to_s )
226
230
user_json_method = SiteSetting . oauth2_user_json_url_method . downcase . to_sym
227
231
228
- log ( "user_json_url: #{ user_json_method } #{ user_json_url } " )
229
-
230
232
bearer_token = "Bearer #{ token } "
231
233
connection = Faraday . new { |f | f . adapter FinalDestination ::FaradayAdapter }
232
234
headers = { "Authorization" => bearer_token , "Accept" => "application/json" }
233
235
user_json_response = connection . run_request ( user_json_method , user_json_url , nil , headers )
234
236
235
- log ( "user_json_response: #{ user_json_response . inspect } " )
237
+ log <<-LOG
238
+ user_json request: #{ user_json_method } #{ user_json_url }
239
+
240
+ response:
241
+ #{ user_json_response . to_yaml }
242
+ LOG
236
243
237
244
if user_json_response . status == 200
238
245
user_json = JSON . parse ( user_json_response . body )
239
246
240
- log ( "user_json: #{ user_json } " )
247
+ log ( "user_json:\n #{ user_json . to_yaml } " )
241
248
242
249
result = { }
243
250
if user_json . present?
@@ -272,9 +279,20 @@ def always_update_user_email?
272
279
end
273
280
274
281
def after_authenticate ( auth , existing_account : nil )
275
- log (
276
- "after_authenticate response: \n \n creds: #{ auth [ "credentials" ] . to_hash } \n uid: #{ auth [ "uid" ] } \n info: #{ auth [ "info" ] . to_hash } \n extra: #{ auth [ "extra" ] . to_hash } " ,
277
- )
282
+ log <<-LOG
283
+ after_authenticate response:
284
+
285
+ creds:
286
+ #{ auth [ "credentials" ] . to_hash . to_yaml }
287
+
288
+ uid: #{ auth [ "uid" ] }
289
+
290
+ info:
291
+ #{ auth [ "info" ] . to_hash . to_yaml }
292
+
293
+ extra:
294
+ #{ auth [ "extra" ] . to_hash . to_yaml }
295
+ LOG
278
296
279
297
if SiteSetting . oauth2_fetch_user_details?
280
298
if fetched_user_details = fetch_user_details ( auth [ "credentials" ] [ "token" ] , auth [ "uid" ] )
0 commit comments