From e89c3dfb313d2f4d7cf45c1294a3a0b93ddfc9eb Mon Sep 17 00:00:00 2001 From: Amolith Date: Mon, 9 Mar 2026 12:30:46 -0600 Subject: [PATCH] Switch BW clients from Basic to Client creds Basic credentials are only usable for id.bandwidth.com, both gems prefer api.bandwidth.com, and only iris seems to fall back to id. This adds the new client cred fields to the config and uses them throughout. --- config-schema.dhall | 8 +++++++- config.dhall.sample | 2 ++ lib/bandwidth_tn_repo.rb | 4 ++-- sgx_jmp.rb | 8 ++++---- test/test_helper.rb | 2 ++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/config-schema.dhall b/config-schema.dhall index 27bcb68a08211cf8f3b303b2754739490199dfef..a5c5e65c41f519aab2c7f8f54b9f3bd2e266fa8a 100644 --- a/config-schema.dhall +++ b/config-schema.dhall @@ -17,7 +17,13 @@ , churnbuster : { account_id : Text, api_key : Text } , component : { jid : Text, secret : Text } , credit_card_url : forall (jid : Text) -> forall (customer_id : Text) -> Text -, creds : { account : Text, password : Text, username : Text } +, creds : + { account : Text + , client_id : Text + , client_secret : Text + , password : Text + , username : Text + } , direct_sources : List { mapKey : Text, mapValue : Text } , direct_targets : List { mapKey : Text, mapValue : Text } , electrum : diff --git a/config.dhall.sample b/config.dhall.sample index 01047c72a341ba57504dcdd8a0e5e9e6ff69050f..010940054b8020dd7f9ecddda2eec0cb49780b09 100644 --- a/config.dhall.sample +++ b/config.dhall.sample @@ -19,6 +19,8 @@ in ], creds = { account = "00000", + client_id = "oauth client id", + client_secret = "oauth client secret", username = "dashboard user", password = "dashboard password" }, diff --git a/lib/bandwidth_tn_repo.rb b/lib/bandwidth_tn_repo.rb index b8f8d6bc1b01727babc3ed6ea911b5afdd565570..4e936f5fd550588c150839f6824238b25382f8be 100644 --- a/lib/bandwidth_tn_repo.rb +++ b/lib/bandwidth_tn_repo.rb @@ -25,8 +25,8 @@ class BandwidthTnRepo @move_client = BandwidthIris::Client.new( account_id: CONFIG[:keep_area_codes_in][:account], - username: CONFIG[:creds][:username], - password: CONFIG[:creds][:password] + client_id: CONFIG[:creds][:client_id], + client_secret: CONFIG[:creds][:client_secret] ) end diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 32072121a736c0623ab7a9f8f7e6db1fb9ed240d..ab52fdc2150e877cc1b6d64b7986cc4a5d566238 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -121,12 +121,12 @@ EM::Hiredis::Client.load_scripts_from("#{__dir__}/redis_lua") Faraday.default_adapter = :em_synchrony BandwidthIris::Client.global_options = { account_id: CONFIG[:creds][:account], - username: CONFIG[:creds][:username], - password: CONFIG[:creds][:password] + client_id: CONFIG[:creds][:client_id], + client_secret: CONFIG[:creds][:client_secret] } Bandwidth.configure do |config| - config.client_id = CONFIG[:creds][:username] - config.client_secret = CONFIG[:creds][:password] + config.client_id = CONFIG[:creds][:client_id] + config.client_secret = CONFIG[:creds][:client_secret] end BANDWIDTH_VOICE = Bandwidth::CallsApi.new diff --git a/test/test_helper.rb b/test/test_helper.rb index 6cb4956b78d259bf5ba3598604d50d5cdc0c28e6..a4102aed39f778cff0a0febf7400e1643d4bb19d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -85,6 +85,8 @@ CONFIG = { }, creds: { account: "test_bw_account", + client_id: "test_bw_client_id", + client_secret: "test_bw_client_secret", username: "test_bw_user", password: "test_bw_password" },