I am working against the latest source from github and I can't seem to find a clear way to disconnect a single connection from a provider. My app allows for multiple Twitter connections, and it seems I can either disconnect all the Twitter connections or none.
Looking into the code in ConnectController disconnecting all the connections is exactly what it does.
This has even been made harder since some of the recent changes to the repository code where the providerAccoundId saving has been removed since it's not used by ServiceProvider framework. Where before I could use a custom AccountService to delete connections based on providerAccountId (eg Twitter Screen Names) now even this is unavailable.
In fact working with a single connection within an array of multiple connections for a given provider is quite cumbersome I find, perhaps the ServiceProvider should define a method:
ServiceProviderConnection<S> getConnection(Serializable accountId, String providerAccountId);
boolean isConnected(Serializable accountId, String providerAccountId);
Just to simplify the process of obtaining a single connection and working with it direct.
Moreover the JavaDoc for the List<ServiceProviderConnection<S>> getConnections(Serializable accountId); says "The first connection in the list is the "primary" connection between the account and this service provider." I am not certain whether in the Twitter example and a user having multiple accounts one is considered a "primary account" they are all of equal value and are not linked to each other.
Is there something I am missing in the ServiceProvider/Connection framework?
Would be great to hear your thoughts.