DEV: Log more information for user json response

Why this change?

Currently we are only logging the `Faraday::Response` object which is
not very useful because it doesn't show the response status code.
This commit is contained in:
Alan Guo Xiang Tan 2024-01-09 10:40:16 +08:00
parent f7608a6d5b
commit 6e3b0b62ff
No known key found for this signature in database
GPG Key ID: 3F656E28E3AADEF1
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# name: discourse-oauth2-basic # name: discourse-oauth2-basic
# about: Allows users to login to your forum using a basic OAuth2 provider. # about: Allows users to login to your forum using a basic OAuth2 provider.
# meta_topic_id: 33879 # meta_topic_id: 33879
# version: 0.3 # version: 0.3
# authors: Robin Ward # authors: Robin Ward
@ -231,7 +231,7 @@ class ::OAuth2BasicAuthenticator < Auth::ManagedAuthenticator
headers = { "Authorization" => bearer_token, "Accept" => "application/json" } headers = { "Authorization" => bearer_token, "Accept" => "application/json" }
user_json_response = connection.run_request(user_json_method, user_json_url, nil, headers) user_json_response = connection.run_request(user_json_method, user_json_url, nil, headers)
log("user_json_response: #{user_json_response.inspect}") log("user_json_response: (#{user_json_response.status}) #{user_json_response.inspect}")
if user_json_response.status == 200 if user_json_response.status == 200
user_json = JSON.parse(user_json_response.body) user_json = JSON.parse(user_json_response.body)