From 7bc71b537867ef44c295041500e102739514cb38 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 26 Oct 2015 12:45:11 -0400 Subject: [PATCH] FIX: Include the `Authorization` header for services that need it --- plugin.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin.rb b/plugin.rb index 0c4a11c..25705a8 100644 --- a/plugin.rb +++ b/plugin.rb @@ -23,6 +23,15 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator } end + def build_access_token + options.token_params.merge!(:headers => {'Authorization' => basic_auth_header }) + super + end + + def basic_auth_header + "Basic " + Base64.strict_encode64("#{SiteSetting.oauth2_client_id}:#{SiteSetting.oauth2_client_secret}") + end + def walk_path(fragment, segments) first_seg = segments[0] return if first_seg.blank? || fragment.blank?