-
Notifications
You must be signed in to change notification settings - Fork 87
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
401 error when using Mongo #85
Comments
+1 |
This is basically fixture problem, mongo doesn't use integer ID's like SQL based databases. So tl:dr when database is initialized created users don't have necessary passport relations attached. |
Sorry, I didn't exactly understand. Could you guide a workaround on this? |
See fixtures for User and Passport models, especially that Passport fixture, see that it relies to numeric So quick fix is to manually alter your mongo db data OR make a PR which fixes this, there is some solutions on barrels repo to make assocs work with fixtures, but basically I haven't had time to make this fix - yet. |
By updating it manually works, but of course is not ideal. I tried creating assocs fixtures but it seems that there is a bug with barrels: http://screencast.com/t/YQhoZ5bC. There is an open issue for that:
|
Yeah, this one needs some serious work. Basically those fixtures should work as the same with any adapter, otherwise those aren't working like those should. But basically this is only problem when creating new app when there isn't any data on db yet. And if your app is using mongo or something else you propably create fixtures using some specified tool. |
You can reproduce it just by changing the connection from sails-disk to sails-mongo. When trying to log in you get a 401 (Unauthorized). It seems that the variable user is false, but not sure where is the issue.
The text was updated successfully, but these errors were encountered: