Index: components/copresence/rpc/http_post.cc |
diff --git a/components/copresence/rpc/http_post.cc b/components/copresence/rpc/http_post.cc |
index 3f2f7a5e3eb1aaee8c6aec12a562e4e3c0550551..68fe528e2794b08685c8d7cdf152910ffcd3cdcb 100644 |
--- a/components/copresence/rpc/http_post.cc |
+++ b/components/copresence/rpc/http_post.cc |
@@ -25,8 +25,9 @@ const char HttpPost::kTracingField[] = "trace"; |
HttpPost::HttpPost(net::URLRequestContextGetter* url_context_getter, |
const std::string& server_host, |
const std::string& rpc_name, |
- const std::string& tracing_token, |
std::string api_key, |
+ const std::string& auth_token, |
+ const std::string& tracing_token, |
const google::protobuf::MessageLite& request_proto) { |
// Create the base URL to call. |
GURL url(server_host + "/" + rpc_name); |
@@ -63,6 +64,9 @@ HttpPost::HttpPost(net::URLRequestContextGetter* url_context_getter, |
net::LOAD_DO_NOT_SEND_COOKIES | |
net::LOAD_DO_NOT_SEND_AUTH_DATA); |
url_fetcher_->SetUploadData("application/x-protobuf", request_data); |
+ if (!auth_token.empty()) { |
+ url_fetcher_->AddExtraRequestHeader("Authorization: Bearer " + auth_token); |
+ } |
} |
HttpPost::~HttpPost() {} |