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

User doesn't get populated after authentication with databases that don't use _id #71

Closed
ekryski opened this Issue Feb 21, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@ekryski
Copy link
Member

ekryski commented Feb 21, 2016

The populateUser() hook gets called automatically by the token service after a token create. Because this hook has _id as the default idField (See this line) when you generate an app using a database that doesn't use the _id field (Postgres, MySQL, etc) the user silently doesn't get populated.

You can pass the idField option to app.configure(authentication({ idField: 'id' })) and it will work but it's not immediately apparent how to fix this.

@ekryski

This comment has been minimized.

Copy link
Member Author

ekryski commented Feb 21, 2016

I'm not sure how to approach this. We could try and infer the database type the user is using but that is going to be way complex and probably have undesired consequences.

Maybe if the user isn't found we throw an error? I can't think of a case where the user shouldn't be found using the id from the auth token. @daffl thoughts?

@fastlorenzo

This comment has been minimized.

Copy link
Contributor

fastlorenzo commented Feb 22, 2016

Maybe you could explicitly require the idField option to be set or document ?

@ekryski

This comment has been minimized.

Copy link
Member Author

ekryski commented Feb 27, 2016

Working in v0.4.0. Closed by #76

@ekryski ekryski closed this Feb 27, 2016

@ekryski ekryski modified the milestone: 0.6 Mar 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.