Skip to content
This repository was archived by the owner on Jul 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def after_authenticate(auth, existing_account: nil)
#{auth["extra"].to_hash.to_yaml}
LOG

if SiteSetting.oauth2_fetch_user_details?
if SiteSetting.oauth2_fetch_user_details? && SiteSetting.oauth2_user_json_url.present?
if fetched_user_details = fetch_user_details(auth["credentials"]["token"], auth["uid"])
auth["uid"] = fetched_user_details[:user_id] if fetched_user_details[:user_id]
auth["info"]["nickname"] = fetched_user_details[:username] if fetched_user_details[
Expand Down
2 changes: 2 additions & 0 deletions spec/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

describe OAuth2BasicAuthenticator do
describe "after_authenticate" do
before { SiteSetting.oauth2_user_json_url = "https://provider.com/user" }

let(:user) { Fabricate(:user) }
let(:authenticator) { OAuth2BasicAuthenticator.new }

Expand Down