Managing HttpClient with Dynamic URL and Authorization in a Layer

I need to have a Layer where I instantiate an HttpClient where the base URL is provided externally from the user. After getting said URL, I need to make a request with it and store the Authorization header too based on the response and use the client for all the next requests.

I was thinking about using a SynchronizedRef for the URL and one for the auth token. Is this a good approach o should I approach the problem from another pov?
Was this page helpful?