Start a new topic

Collection Hooks, Social.connect & OAuth2 - ability to intercept response and 'munge' ?

Current Social.connect solution appears to require multiple round-trip actions to correctly associate the social (Facebook, Google + etc.) attributes with a 'New' user.

I may be misinterpreting the process, but it appears that Kinvey packages up the request placed in the onPreSave fn, places the calls to the provider, and then the various kinvey libs ( AngularJs, NodeJs ..) intercept the response and based on options sent will either

findOne & done (sending nothing in response other than 'user not found' err );


create and new user (username, password auto-set to hash) and then will respond to the client with full payload (acl, id, _kmd, _socialIdentity, username, password).

Are we not able to perform custom find prior to create?

Is the only method we have to correctly associate _socialIdentity response attributes with proper user fields is to perform update -- probably just in the promise chain --requiring another roundtrip to complete.

Is this correct? is there some other BL operation that could be done to eliminate this 'update' step? could we not (i.e. passport) simply parse attributes to json, perform 'findOneOrUpdate' assigning proper user attribute, then return to client? Is it simply more efficient to create on request via I assume BL ?

Apologize for length. - thanks
1 Comment

If I understand your issue correctly you are trying to associate additional user fields when connecting with a social identity? You can do this by leveraging the first parameter:

`Kinvey.Social.connect({ foo: true }, 'twitter');`

The above will add `foo: true` to the user attributes (updating when the user already exists, adding as field when creating otherwise). This way, you don’t have to call update separately.

If this is not what you mean, can you provide an example of what you’d like to see? I am a bit lost with what you mean with "custom find prior to create".
Login or Signup to post a comment