@@ -52,9 +52,11 @@ def request(env)
5252 warn <<~LOG
5353 OAuth2 Debugging: request #{ env . method . upcase } #{ env . url . to_s }
5454
55- Headers: #{ env . request_headers }
55+ Headers:
56+ #{ env . request_headers . to_yaml }
5657
57- Body: #{ env [ :body ] }
58+ Body:
59+ #{ env [ :body ] . to_yaml }
5860 LOG
5961 end
6062
@@ -64,9 +66,11 @@ def response(env)
6466
6567 From #{ env . method . upcase } #{ env . url . to_s }
6668
67- Headers: #{ env . response_headers }
69+ Headers:
70+ #{ env . request_headers . to_yaml }
6871
69- Body: #{ env [ :body ] }
72+ Body:
73+ #{ env [ :body ] . to_yaml }
7074 LOG
7175 end
7276end
@@ -224,19 +228,22 @@ def fetch_user_details(token, id)
224228 user_json_url = SiteSetting . oauth2_user_json_url . sub ( ":token" , token . to_s ) . sub ( ":id" , id . to_s )
225229 user_json_method = SiteSetting . oauth2_user_json_url_method . downcase . to_sym
226230
227- log ( "user_json_url: #{ user_json_method } #{ user_json_url } " )
228-
229231 bearer_token = "Bearer #{ token } "
230232 connection = Faraday . new { |f | f . adapter FinalDestination ::FaradayAdapter }
231233 headers = { "Authorization" => bearer_token , "Accept" => "application/json" }
232234 user_json_response = connection . run_request ( user_json_method , user_json_url , nil , headers )
233235
234- log ( "user_json_response: #{ user_json_response . inspect } " )
236+ log <<-LOG
237+ user_json request: #{ user_json_method } #{ user_json_url }
238+
239+ response:
240+ #{ user_json_response . to_yaml }
241+ LOG
235242
236243 if user_json_response . status == 200
237244 user_json = JSON . parse ( user_json_response . body )
238245
239- log ( "user_json: #{ user_json } " )
246+ log ( "user_json:\n #{ user_json . to_yaml } " )
240247
241248 result = { }
242249 if user_json . present?
@@ -271,9 +278,20 @@ def always_update_user_email?
271278 end
272279
273280 def after_authenticate ( auth , existing_account : nil )
274- log (
275- "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 } " ,
276- )
281+ log <<-LOG
282+ after_authenticate response:
283+
284+ creds:
285+ #{ auth [ "credentials" ] . to_hash . to_yaml }
286+
287+ uid: #{ auth [ "uid" ] }
288+
289+ info:
290+ #{ auth [ "info" ] . to_hash . to_yaml }
291+
292+ extra:
293+ #{ auth [ "extra" ] . to_hash . to_yaml }
294+ LOG
277295
278296 if SiteSetting . oauth2_fetch_user_details?
279297 if fetched_user_details = fetch_user_details ( auth [ "credentials" ] [ "token" ] , auth [ "uid" ] )
0 commit comments