Skip to content

[User system] Proposal: Support multiple OAuth providers of same type #682

@lirbank

Description

@lirbank

I am a long time Meteor developer and I was looking for alternative account systems when I found Horizon. A huge drawback with Meteor's Accounts/Users system (or actually the data model behind it) is that you can only have one OAuth provider of the same type per user.

Horizon has made the same design decision, so just wanted to give you a heads up before it's too late (or much harder) to change it.

The use case: you want to allow a single user to log in with multiple authentication sources (FB, Google, U/P, etc). Many users have more than one google account, and these can't be merged with the data model Horizon/Meteor has decided on.

See: http://horizon.io/docs/users/ (only one "google" provider per user possible):

{
    "id": "D6B8E9D0-CD96-4C01-BFD6-2AF43141F2A7",
    "groups": [ "default", "authenticated" ],
    "providers": {
        "google": { /* third-party user profile /* }
    },
    "data": {
        "key1": "value1",
        "key2": "value2",
        ...
    }
}

A better model is to make "providers" an array (multiple "google" providers possible):

{
    "id": "D6B8E9D0-CD96-4C01-BFD6-2AF43141F2A7",
    "groups": [ "default", "authenticated" ],
    "providers /* should perhaps name this something else */": [
        {
            "provider": "google",
            "accessToken": "xyz",
            "id": "123",
            /* third-party user profile /*
        },
        {
            "provider": "google",
            "accessToken": "abc",
            "id": "456",
            /* third-party user profile /*
        },
        {
            "provider": "facebook",
            "accessToken": "def",
            "id": "567",
            /* third-party user profile /*
        }
    ],
    "data": {
        "key1": "value1",
        "key2": "value2",
        ...
    }
}

This would give app and plugin developers more flexibility to implement merging of accounts, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions