meteor-link-accounts
meteor-link-accounts copied to clipboard
Redirect style will create new user
it's fine to link account in popup style, but wechat-mp require to use redirect style, which is a limit of the wechat. could you please support link account with redirect style?
I'll have to look into how wechat works and from that figure out where the issue is. I don't use wechat so I won't get to this any time soon, so if someone else wants to look into this, it will be much appreciated.
I've looked through the code and I don't see where the issue can originate. Did you make any progress on this @zhaoyao91 ? Did you try the newest version?
This is not related to wechat. I use google and facebook, and when the flow is set to redirect a new user is created instead of adding the information to the logged in user.
I think it's because Meteor has some logic in accounts-oauth that automatically calls the default oauth login on the server if oauth information is found at page load, and that login handler automatically creates a new user, skipping the call to the callback of this package.
The code that I am talking about is in accounts-oauth:
Meteor.startup(() => {
const oauth = OAuth.getDataAfterRedirect();
if (! oauth)
return;
// We'll only have the credentialSecret if the login completed
// successfully. However we still call the login method anyway to
// retrieve the error if the login was unsuccessful.
const methodName = 'login';
const { credentialToken, credentialSecret } = oauth;
const methodArguments = [{ oauth: { credentialToken, credentialSecret } }];
Accounts.callLoginMethod({
methodArguments,
userCallback: err => {
// The redirect login flow is complete. Construct an
// `attemptInfo` object with the login result, and report back
// to the code which initiated the login attempt
// (e.g. accounts-ui, when that package is being used).
err = convertError(err);
Accounts._pageLoadLogin({
type: oauth.loginService,
allowed: !err,
error: err,
methodName,
methodArguments,
});
}
});
});
This will call the normal oauth login handler instead of the link
@MastroLindus Thanks a lot for locating the code. I will see what we can do to fix this in core.
Same issue here with Google (linkWithGoogle) and loginStyle: "redirect" calls Some progress on this issue ?