XF 2.0 Adding new Connected Account Providers?

Jaxel

Well-known member
Licensed customer
Looking at XF\ConnectedAccount\Provider and XF\ConnectedAccount\ProviderData, I've been able to create new files for my provider... but I'm not seeing where to actually change API endpoints... What am I missing here?
 
Running the "test provider" function, I am getting the following error:
InvalidArgumentException: Cannot find a valid OAuth Service for provider 'Discord' in src/XF/ConnectedAccount/Provider/AbstractProvider.php at line 152
  1. XF\ConnectedAccount\Provider\AbstractProvider->getOAuth() in src/XF/ConnectedAccount/Provider/AbstractProvider.php at line 103
  2. XF\ConnectedAccount\Provider\AbstractProvider->handleAuthorization() in src/XF/Admin/Controller/ConnectedAccount.php at line 68
  3. XF\Admin\Controller\ConnectedAccount->actionPerformTest() in src/XF/Mvc/Dispatcher.php at line 249
  4. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 89
  5. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
  6. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1880
  7. XF\App->run() in src/XF.php at line 328
  8. XF::runApp() in admin.php at line 13

Where do I create an OAuth Service? I'm not finding any OAuth services for other providers to use an example.
 
Note this comment in the abstract provider class for defining the service:
Code:
/**
 * Represents the name of the OAuth service.
 *
 * This can be given as a class name if there isn't a service already defined within the OAuth library.
 * e.g. '\XF\ConnectedAccount\Service\ProviderId' or 'XF:Service\ProviderId'
 * 
 * You can check if a service already exists by looking in 'src/vendor/lusitanian/oauth/src/OAuth/OAuth(1|2)\Service'
 *
 * @return string
 */
 
Oh... I get it now...

Code:
    public function getOAuthServiceName()
    {
        return 'EWR\Discord:Service\Discord';
    }
    
    public function getProviderDataClass()
    {
        return 'EWR\Discord:ProviderData\Discord';
    }
 
Back
Top Bottom