meteor-accounts-meld
meteor-accounts-meld copied to clipboard
Possible to allow melding of multiple same service different accounts?
hello splendido! I really need the option to allow connect multiple accounts of same social network for example connect 3 different Facebook accounts just make them available in the Meteor.user() services collection. Is it hard to accomplish is there any issues with that? It's basically for API calls (not for FB). Thanks
Yeah, unfortunately this is not possible at the moment, unless we rewrite all accounts packages from Meteor core.
See for example this line and this line from the method used to find the user to which a service is linked. The selector used suppose you have the usual structure inside the user object:
{
...
services: {
password: { ... },
facebook: {
id: 'asldknijasf,.naflk',
...
},
google: {
id: 'asadsasdaflkhgf',
...
},
...
}
}
The only solution, IMHO, should be to not relay on the original updateOrCreateUserFromExternalService method and roll our own one to be used here. The services object should be then changed to keep an array of objects for each service like this:
{
...
services: {
...
facebook: [
{ id: 'asadsasdaflkhgf', ... },
{ id: 'opsdnsdhansah', ... },
{ id: 'qwpodmcsaalm', ... },
],
google: [...],
}
...but then we'll also have to add new indices on the users collection drawing this one completely unuseful (hoping it's not going to make problems with the new array structure...)
I think I'll open a new thread about this here This is anyway worth investigating!
Tnx
+1
+1 for some solution but changing the core user structure worries me. This would make any additional user packages unusable. Would it be better to leave the current object structure and use it to identify a 'primary' account? We could have a user.meldServices.facebook = [] structure in the background and one of those marked a primary, which would also be in user.services.facebook = {}.
@Kestanous Yeah why the hell not can't this be done separately?
we'll have to change the selector to find the user to be associated to the current log in attempt anyway... ...I guess if MDG changed the underlying structure everything might turn out to be easier. and the primary account for each service might be marked by using an additional field inside the service object.
but I agree it will be a breaking change!
In any case I guess we'll have to roll our own solution, so if you think with some more effort we can do a separate tracking while not breaking most of the current packages, we'll go for it I guess!
...but then I already see someone asking to change the default facebook profile, which will require moving services object from one list to the other and stuff like this ;-)
I would prefer to have one list and order of accounts in the list signify importance of the account.
We could simply create a separate accounts system with other schema.
Really my concern is lets not split the community. Convincing MDG to fix users would be the ideal. We can all change our packages but we should be in agreement with how things should work.
Could you all please report your comments also on the above cited issue @ MeteorCommunity?
@Kestanous my observations that MDG doesn't really take users opinions very seriously I didn't see any requests being answered so I think there is no much choice...
@voidale and thus my array + primary recommendation :/ Its not great but IMO it's better the full community split.