From b935bb6bee11187eadbb49bed963bb9ef4520263 Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Wed, 27 Nov 2024 20:44:46 +0100 Subject: [PATCH] Support userinfo in teams url --- lib/livebook/teams/requests.ex | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/livebook/teams/requests.ex b/lib/livebook/teams/requests.ex index 63306875f731..ca581c1ef5a1 100644 --- a/lib/livebook/teams/requests.ex +++ b/lib/livebook/teams/requests.ex @@ -291,10 +291,21 @@ defmodule Livebook.Teams.Requests do end defp build_req() do - Req.new( - base_url: Livebook.Config.teams_url(), - headers: [{"x-lb-version", Livebook.Config.app_version()}] - ) + base_url = URI.new!(Livebook.Config.teams_url()) + + options = + if userinfo = base_url.userinfo do + [ + base_url: %{base_url | userinfo: nil}, + auth: {:basic, userinfo} + ] + else + [ + base_url: base_url + ] + end + + Req.new([headers: [{"x-lb-version", Livebook.Config.app_version()}]] ++ options) |> Livebook.Utils.req_attach_defaults() end