Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Facebook Authentication should do a patch not an update. #174

Closed
DenJohX opened this issue Apr 25, 2016 · 4 comments · Fixed by #183
Closed

Facebook Authentication should do a patch not an update. #174

DenJohX opened this issue Apr 25, 2016 · 4 comments · Fixed by #183
Labels

Comments

@DenJohX
Copy link

DenJohX commented Apr 25, 2016

Using a feathers-cli generated app with mongodb, if the user model has more fields (other than facebook-id and facebook data), all those fields gets erased when the user authenticates.

This happens because the authentication proccess updates the social information of the user by sending a full update to the user service, thus eliminating any other field the user may have. I think should be better to patch the user instead of updating it.

@ekryski ekryski added the Bug label Apr 25, 2016
@beevelop
Copy link
Contributor

beevelop commented Apr 27, 2016

I can confirm that using update leads to the described side-effects. This bug is very likely to be independent of the used database – however I can reproduce it for MySQL too.

@marshallswain
Copy link
Member

Do one of you want to try changing this line to do patch instead of update?: https://github.com/feathersjs/feathers-authentication/blob/master/src/services/oauth2/index.js#L63

And see if it resolves the issue? Thanks.

@beevelop
Copy link
Contributor

Yeah, I already did so: beevelop/feathers-authentication@a7300f8
I can confirm this results in the excepted behaviour (by not crashing your user entry).

@marshallswain
Copy link
Member

Cool! Would you mind making a PR out of that?

beevelop added a commit to beevelop/feathers-authentication that referenced this issue Apr 27, 2016
Using update() leads to conflicts with non-default user models and effectively in loosing the user's
data. By using patch the data gets merged properly.

fixes feathersjs-ecosystem#174
beevelop added a commit to beevelop/feathers-authentication that referenced this issue Apr 27, 2016
Using update() leads to conflicts with non-default user models and effectively in loosing the user's
data. By using patch the data gets merged properly.

fixes feathersjs-ecosystem#174
ekryski added a commit that referenced this issue Apr 28, 2016
fix(oauth2): Use patch to update user in oauthCallback
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants