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

Redirect style will create new user #58

Open
zhaoyao91 opened this issue Nov 13, 2016 · 6 comments
Open

Redirect style will create new user #58

zhaoyao91 opened this issue Nov 13, 2016 · 6 comments
Labels
bug good first issue This is an easy issue that beginners can tackle to get to know the code base.

Comments

@zhaoyao91
Copy link

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?

@StorytellerCZ
Copy link
Member

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.

@StorytellerCZ StorytellerCZ added bug good first issue This is an easy issue that beginners can tackle to get to know the code base. labels Oct 15, 2019
@StorytellerCZ
Copy link
Member

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?

@MastroLindus
Copy link

MastroLindus commented Feb 19, 2020

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.

@MastroLindus
Copy link

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

@StorytellerCZ
Copy link
Member

@MastroLindus Thanks a lot for locating the code. I will see what we can do to fix this in core.

@micktaiwan
Copy link

Same issue here with Google (linkWithGoogle) and loginStyle: "redirect" calls
Some progress on this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue This is an easy issue that beginners can tackle to get to know the code base.
Projects
Development

No branches or pull requests

4 participants