Jake Vanderwerf
2026-08-30 a58a2e7ca4700d3e23341fde767060a4c2c704a3
inc/integrations/OAuth.php
@@ -10,7 +10,7 @@
trait OAuth
{
   use _Base, Admin;
   use _Base, Admin, ServiceMap;
   protected OAuthURLs $oauth;
   /**
    * Child classes must set this (e.g. 'https://api.example.com/v1/')
@@ -38,6 +38,10 @@
   {
      return $this->getRequestHeaders();
   }
   public function getOAuthBaseURL():?string
   {
      return $this->baseOAuthUrl;
   }
   /**
    * Default to the base handleResponse method, but extensions can modify accordingly
@@ -291,12 +295,14 @@
      }
      // Get integration instance
      $integration = JVB()->connect($this->service_name, $user_id);
      $integration = $this->getService($this->service_name);
      if (!$integration) {
      if (!$integration || !method_exists($integration, 'switchUser')) {
         wp_die('Invalid service: ' . esc_html($this->service_name), 'OAuth Error');
      }
      $integration->switchUser($user_id);
      // Exchange code for tokens
      $result = $integration->handleOAuthCode($code, $state);