Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom UserFields #2

Open
yorickdevries opened this issue Jun 13, 2020 · 2 comments
Open

Custom UserFields #2

yorickdevries opened this issue Jun 13, 2020 · 2 comments

Comments

@yorickdevries
Copy link

Is it possible to specify the fields of a User manually? Or is a user only allowed the fields that are defined in the interface?

@cszatmary
Copy link
Owner

Hi @yorickdevries, are you using TypeScript or JavaScript? I am working on updating this library and am considering rewriting everything using generics so users of this library can decide what fields the User should have.

Currently the MockStrategy type doesn't assume anything about the user. However some of the other helper functions exported by this library do assume certain fields (ex: id).

@yorickdevries
Copy link
Author

I am using Typescript and there indeed the fields id, name, emails, provider are expected. What I do now is:

const strategy = new MockStrategy({
  name: "mock",
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  user: user as any,
});
passport.use(strategy);

But if you could make an update using generics, that would certainly be a nice addition!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants