@@ -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
@@ -223,19 +227,22 @@ def fetch_user_details(token, id)
223
227
user_json_url = SiteSetting . oauth2_user_json_url . sub ( ":token" , token . to_s ) . sub ( ":id" , id . to_s )
224
228
user_json_method = SiteSetting . oauth2_user_json_url_method . downcase . to_sym
225
229
226
- log ( "user_json_url: #{ user_json_method } #{ user_json_url } " )
227
-
228
230
bearer_token = "Bearer #{ token } "
229
231
connection = Faraday . new { |f | f . adapter FinalDestination ::FaradayAdapter }
230
232
headers = { "Authorization" => bearer_token , "Accept" => "application/json" }
231
233
user_json_response = connection . run_request ( user_json_method , user_json_url , nil , headers )
232
234
233
- log ( "user_json_response: #{ user_json_response . inspect } " )
235
+ log <<-LOG
236
+ user_json request: #{ user_json_method } #{ user_json_url }
237
+
238
+ response:
239
+ #{ user_json_response . to_yaml }
240
+ LOG
234
241
235
242
if user_json_response . status == 200
236
243
user_json = JSON . parse ( user_json_response . body )
237
244
238
- log ( "user_json: #{ user_json } " )
245
+ log ( "user_json:\n #{ user_json . to_yaml } " )
239
246
240
247
result = { }
241
248
if user_json . present?
@@ -270,9 +277,20 @@ def always_update_user_email?
270
277
end
271
278
272
279
def after_authenticate ( auth , existing_account : nil )
273
- log (
274
- "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 } " ,
275
- )
280
+ log <<-LOG
281
+ after_authenticate response:
282
+
283
+ creds:
284
+ #{ auth [ "credentials" ] . to_hash . to_yaml }
285
+
286
+ uid: #{ auth [ "uid" ] }
287
+
288
+ info:
289
+ #{ auth [ "info" ] . to_hash . to_yaml }
290
+
291
+ extra:
292
+ #{ auth [ "extra" ] . to_hash . to_yaml }
293
+ LOG
276
294
277
295
if SiteSetting . oauth2_fetch_user_details?
278
296
if fetched_user_details = fetch_user_details ( auth [ "credentials" ] [ "token" ] , auth [ "uid" ] )
0 commit comments