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

preSignUpHook isn't called for social sign up #669

Open
elie222 opened this issue Apr 19, 2016 · 11 comments
Open

preSignUpHook isn't called for social sign up #669

elie222 opened this issue Apr 19, 2016 · 11 comments

Comments

@elie222
Copy link

elie222 commented Apr 19, 2016

This seems to be a bug to me, unless it was intended for some reason.

This code:
https://github.com/meteor-useraccounts/core/blob/master/lib/templates_helpers/at_pwd_form.js#L203

Needs to be added somewhere in this file:
https://github.com/meteor-useraccounts/core/blob/master/lib/templates_helpers/at_social.js

@elie222
Copy link
Author

elie222 commented Apr 20, 2016

The problem is that the social login code is called for signup and signin. Not sure how we can easily add the hook into social signup.

@sjkdev21
Copy link

sjkdev21 commented Jun 15, 2016

This is a really critical issue to fix for purposes of accurate analytics tracking on user signups (among other things). Especially if you are trying to track multiple funnels into your app. If someone can point me in the right direction I would attempt to fix the issue.

@elie222
Copy link
Author

elie222 commented Jun 15, 2016

I agree.
Here's a hacky way around it in this package I created: https://github.com/elie222/meteor-referrals
I'm not sure this technique can or should be added to User Accounts however.

@sjkdev21
Copy link

Great workaround - thanks elie!

@sjkdev21
Copy link

A better solution would be to edit (or as a cleaner hack use underscore's _.wrap()) whatever function the social buttons are calling when they need to create a user from the client side, and call the pre/post sign up hooks from there. I just can't seem to locate where the heck the social buttons call to create a user (on the client side) if they try to do an OAuth login and can't match it to an existing account.

@elie222
Copy link
Author

elie222 commented Jun 15, 2016

This might be of help: https://github.com/meteor-useraccounts/core/blob/master/lib/server_methods.js#L7

But you may need to have a look at the styling packages. E.g. useraccounts-bootstrap, to see where the client makes the calls to the server.

I would be interesting to see how this works out.

@sjkdev21
Copy link

I had come across this before, but we need to find where it is called on the client side. I will look again now.

@sjkdev21
Copy link

Finally got around to tracking this down/fixing it today.

Pull request to fix this issue here: meteor/meteor#7411

In the meantime, you can just copy/redefine the Accounts.updateOrCreateUserFromExternalService on the server side of your Meteor app to contain my updated version of the function as seen here. https://github.com/oohaysmlm/meteor/blob/7419a0d577d2cd09942fc6a96677da51d064f035/packages/accounts-base/accounts_server.js#L1326

This still doesn't solve the need to pass variables from the client to the server via an OAuth login - it just ensures the postSignUpHook will fire.

@Bandit
Copy link

Bandit commented Aug 17, 2016

@tmeasday can you chime in on this and #685? You declined a pull request wanting discussion - well here it is.

@tmeasday
Copy link

@Bandit I'm not really seeing the answer the question I asked:

What is the equivalent code for normal signup that triggers this hook in accounts-base?

Can we open a issue against meteor/meteor outlining what's missing and what the intended solution is?

@juzt3
Copy link

juzt3 commented Oct 9, 2016

In the meantime i have a workaround by checking if the field "roles" is undefined after every login using Accounts.onLogin and calling a method that sets the field

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

5 participants