Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Discuss: Thoughts about identity handling #337

@sielay

Description

@sielay

Hi

I do enjoy learning and doing on this MEAN stack. In my projects I heavily play with multiple identity providers (can say that your code works well with all passport strategies I found so far). I have listed few things you may consider to address:

  • putting first non-email provider into user.providerData and all other to user.additionalProviders has no benefits and a lot of workarounds needed. Following snippet can be useful:
UserSchema.methods.getProviderData = function ( provider ) {
    if ( this.provider === provider ) {
        return this.providerData;
    }
    return this.additionalProvidersData[ provider ];
};
  • many strategies and/or APIs aren't very consequent about user ids. Many of them (like Github or Trello) allow you to use user hash and unique user name. We often save hash as user field for authentication sake, but later API calls often prefer to get username. We may consider having multi-id per provider.
  • previous point lead to one of biggest pitfalls - we assume user can have only one email connected to the app; that also limit hugely use cases

Why I think that should be in core:
Authentication is core. It's not modular. A lot of different parts of the stack depend on it. If I fork out with huge changes, my project (or anyone who would like to say contributor to the root repo) will lose chance to link close to origin.

I try to address some of the issues in my small lib (https://github.com/sielay/octopusidentity doc is not up to date, but meanuserplugin is in latest version (npm not updated yet)). It puts some of the issues abstract, but to achieve all I want I would have to interfere more in core.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions