Implemented XF2 connected accounts

digitalpoint

Well-known member
It's easy to add a connected account provider class (specified in the appropriate table), but there are two related classes that go with the provider class (ProviderData and the underlying Service class).

XF2 still expects ProviderData and Service classes to be in the normal XF and vendor directories which makes it a little kludgey to add a new provider via an addon.

Maybe it would make sense that the Provider class has a method to get it's respective ProviderData and Service class (or just an option for it to override the default locations)?
 
Upvote 0
This suggestion has been implemented. Votes are no longer accepted.
Your connected account provider class, has a method which does indeed look here, by default:
PHP:
return 'XF:ProviderData\\' . $this->getOAuthServiceName();
It's your own connected account provider, though (that extends XF\ConnectedAccount\Provider\AbstractProvider) so you would just override that method.

Similarly, there's an abstract method which you have to override to specify the provider service name.

If it's a default service which the library already supports (you can view those in
src/vendor/lusitanian/oauth/src/OAuth/OAuth(1|2)\Service), then you just specify the service name, e.g. Facebook, Twitter, etc.

Otherwise you just specify the short class name, e.g. YourAddOnId:Service\ServiceName or a fully qualified class name, e.g. YourAddOnId\ConnectedAccount\Service\ServiceName.

As such, I think this is implemented.
 
You would think that I would have looked to see if the exact thing I was suggesting already existed, wouldn't you? lol

Obviously you can disregard this because it's already implemented (and works) exactly like I wanted it to. haha
 
Top Bottom