Basic Auth config options

Created on 9 November 2023, about 1 year ago
Updated 11 June 2024, 5 months ago

I have a question that closely follows on the answer provided here: https://www.drupal.org/project/http_client_manager/issues/3015715

If we put API credentials in a yml file as shown, then they are committed in plain text to the repo. So I've been looking for ways around this. Unfortunately, because of the idiosyncracies of my project's deployment system, settings.local.php is also committed, so putting "secrets" there isn't viable.

To pull credentials out of somewhere and jam them into the Authorization header before a request is sent, I've followed the example provided in HttpClientManagerExampleSubscriber, and added a header in a middleware snippet: return $request->withHeader('Authorization', 'Basic '. $encoded);.

Is this really the way to do it? I had to dig in to find this, and it strikes me as probably more complicated than it should be.

💬 Support request
Status

Fixed

Version

10.0

Component

Code

Created by

🇺🇸United States datawench

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024